How to keep a git branch in sync with master

785    Asked by CsabaToth in Data Science , Asked on Jul 16, 2021

At the moment git is doing my head in, I cannot come up with the best solution for the following.

There are two branches, one called master and one called mobiledevicesupport. I want to keep mobiledevicesupport as a continuous branch that will be merged/synced with the master branch whenever mobiledevicesupport is stable. This would merge changes from mobiledevicesupport into master but also bring all the changes from master into mobiledevicesupport so that branch can continue to be worked on and the features improved or amended. This needs to work with a central repository and multiple developers.

Please an example of similar workflows other people use or just tell me if this idea is stupid and I should consider other options. At the moment the workflow seems sound, but I just don't know how I can make git work this way.

Answered by Amit jaisawal

For keeping a git sync branch with master. You can do:

To keep your local branch updated with the master

git checkout master
git pull
git checkout
git merge master

This will keep your local branch updated to the master and if are ready to push your local branch to the remote repo, then you merge it with the master:

git checkout master
git merge
git push origin master
Thus, you can keep a git branch in sync with the master.

Your Answer


Parent Categories