2
votes

I am using VSTS GIT source control repository and splitting my development into two branches, develop for on-going development, and then a master branch to release from.

Everything is going great except when I want to merge my develop branch into master, the pull-request completes, but it leaves the master branch '1 ahead' of the develop branch, and the VSTS GUI keeps prompting me to create a pull request from master back into develop. When I compare the branches there are of course no differences.

How can I merge my develop branch into master without GIT thinking master is now 1 ahead and making it look like everything is out of sync?

Thank you!

2
keeps prompting me to create a pull request from master into main - you mean from develop into master? - mkrieger1
Yes sorry, edited. After merging from develop into master, VSTS Branch GUI keeps prompting claiming master is 1-change ahead of develop and prompting me to create another pull request from master back into develop - watdo

2 Answers

1
votes

When you merge develop branch into master branch a new merge commit is created in master (commit message like Merge branch 'develop' of <repo-name> into master) but this new merge commit is not present in your develop branch.

so, when you check out to 'develop' branch git thinks develop are one commit (merge commit) behind from the master.

master branch '1 ahead' of the develop branch

You can Pull master into develop to ignore this message.

$ git checkout develop
$ git pull origin master
1
votes

Regarding VSTS git pull request merge, it generates the new commit for pull request merge with different ID at branch level of repository. You can check it in Code > Files > Select the repository > Select a branch > History.

For example:

enter image description here

enter image description here

So, for m1 branch, the pointer point to 25a5b862…, but for master branch, it points to cc36e063…, that why master has 1 head of m1.

However, if you merge the branch by using Git command and push to the server, then the commit ids are the same, so the ahead of value is 0.

Regarding your problem, since you merged develop branch to master, you can set master branch as the compare branch (click … > Set as compare branch). (result: 1 behind of master)