Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (29.3k points)

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.

1 Answer

0 votes
by (50.2k points)

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

To keep your local branch updated with the master 

git checkout master

git pull

git checkout <local-branch>

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 <local-branch>

git push origin master

Thus, you can keep a git branch in sync with the master.

Browse Categories