How to keep a git branch in sync with master
yes just do
git checkout master
git pull
git checkout mobiledevicesupport
git merge master
to keep mobiledevicesupport in sync with master
then when you're ready to put mobiledevicesupport into master, first merge in master like above, then ...
git checkout master
git merge mobiledevicesupport
git push origin master
and thats it.
the assumption here is that mobilexxx is a topic branch with work that isn't ready to go into your main branch yet. So only merge into master when mobiledevicesupport is in a good place
Whenever you want to get the changes from master into your work branch, do a git rebase <remote>/master
. If there are any conflicts. resolve them.
When your work branch is ready, rebase again and then do git push <remote> HEAD:master
. This will update the master branch on remote (central repo).
concept47's approach is the right way to do it, but I'd advise to merge with the --no-ff option in order to keep your commit history clear.
git checkout develop
git pull --rebase
git checkout NewFeatureBranch
git merge --no-ff master