Adds

Saturday, April 27, 2019

How to move a branch into master ( GIT )



From time to time when developing, you can create a branch and work in that branch for a little too long.
It may be desirable to move all that code back to the master branch:

git checkout branchtoBeMoved
git merge -s ours master
git checkout master
git merge branchtoBeMoved

Explanation:
git checkout branchtoBeMoved   - change to the branch we want to move to master
git merge -s ours master –( merge documentation ) we are merging master to the branchtoBeMoved , the specified strategy (-s ours) means that we are always going to favor branchtoBemoved when merging (as we are in that branch at the moment)
git checkout master – change to the master branch
git merge branchtoBemoved – merge code into master

No comments:

Post a Comment