This is the workflow we currently follow:
- Finish a feature and merge it into
develop
branch - Create a
release
branch from develop - Run build scripts on
release
branch - Create a pull request to merge the
release
branch intomaster
- Accept the
release
branch pull request and merge - The
master
branch can then deploy to live server by running deploy command
This all works great, except in my Git repo my branches are out of sync master
is now behind develop
because it doesn't have the merge commits that happened from the pull request merging the release
branch into develop
. But master
is also ahead of develop
as it now contains merge commits from the pull request to get the release
branch into master
I am able to click sync in Bit Bucket to get all the branches up to date, but this just feels like an odd process to go through and would be nicer to keep the branches in sync automatically.
Or, does it not really matter that they are out of sync?
Here is a link to Git Flow process in case you are unfamiliar with it: http://nvie.com/posts/a-successful-git-branching-model/
Thanks.
When you merge the release branch to master you either merge develop also and push the updated develop branch or create a new one from the master. If you merge develop and push then everyone who has access to develop will get updated develop branch on next update.
Your master and remotes master are out of sync as you have not taken update from the remote. This you have to do! :)
Adding nwinkler's answer for better visibility as answer:
You need to merge back into develop after doing the release. In our workflow, I merge the master branch back into develop after the release. That way you get all of the changes from the release merge and you make sure that you can merge everything into master when you do the next release. Looks like that last step is missing from your workflow
If you got what you wanted then please accept it and close it!
Hope it helped!
来源:https://stackoverflow.com/questions/28602722/how-to-keep-branches-in-sync-when-using-git-flow