I use gitflow-avh and gitlab for several years and I’m quiet happy with these tools. It just happened some months ago my team and me started some projects using gitflow together with gitlab merge requests (MR). Merge request are really helpful for code reviews and discussions around features. But unfortunately they don’t integrate with gitflow very well.

Gitlab encourages you to use gitlab flow which works quiet different than the gitflow approach. Branches getting merged against develop (like feature branches) are no problem. Just adjust your target branch. But branches getting merged against master are another topic.

Gitflow does a lot more then gitlab when merging a release or hotfix branch against master: it creates a tag and updates develop. So naturally one would just get the approval of colleges and automated test results via CI in the MR and do the merge locally afterwards.

Gitlab supports this approach and will mark a MR as merged as soon as it detects it got merged into target branch. It “just” needs the source branch to stay around for that. That’s my problem: gitflow automatically deletes the merged branch remotely and gitlab can’t detect the MR got merged.

To work around one could do two things:

  • finishing feature/hotfix/release with --keepremote flag
    git flow release finish 1.2.3 --keepremote
    
  • or enable --keepremote flag permanently:
    git config --add gitflow.release.finish.keepremote true
    

Now gitlab will detect a MR got merged, mark it as this and provide a “remove source” button. To enable this in all my projects a created a small script and run it in the relevant git repositories.