After merge of release branch, why is master 1 commit ahead of develop?

OutOFTouch picture OutOFTouch · Jun 7, 2016 · Viewed 6.9k times · Source

I am still new to this so I am trying to understand why master ends up 1 commit ahead of develop instead of the same after merging a release branch back into develop and master.

My develop branch was 5 commits ahead of master, then I created a release branch and tagged which was also 5 commits ahead of master, then I merged release branch back into develop and master but master ends up 1 commit ahead of develop.

Is this because no changes were made to the release branch and it was the same as develop so the merge didn't create a commit on develop but it did on master which makes master 1 commit ahead even though master and develop now are the same at this point?

Is this ok? Will this cause any problems?

Answer

Scott Weldon picture Scott Weldon · Jun 7, 2016

The issue is that the merge commit is being detected. Your commit history probably looks something like this:

*------------------ A [master]
 \                 /
  *---*---*---*---B [develop,release]

Commit B is, as you mention, 5 commits ahead of master. When you merged the release branch back into master, this created a merge commit, A. That merge commit does not yet exist in develop.

This is not something that you need to worry about, because the merge commit doesn't contain any changes itself, it only merges the two histories together. Normally, that commit will automatically end up in develop next time you finish a hotfix branch anyway.