loading...
Cover image for Merging Changes from another Local Branch

Merging Changes from another Local Branch

jwp profile image John Peters Updated on ・1 min read

But...officer the ship is still salvagable!

Scenario:

We make a bunch of changes and commit them only to find out we were on the master branch. How do we solve this problem? Any attempts to push to master are never allowed.

git checkout -b 'NewBranchName'
// should be in that branch now
git merge master
// all the commits on master are brought over to new branch
git push
//all changes are pushed up via the new branch!

Enter fullscreen mode Exit fullscreen mode

Ah, yes! We saved the ship from sinking.

JWP2020

Discussion

pic
Editor guide