KinsDotNet KinsDotNet - 2 days ago 6
Git Question

How do I bring my current branch up to date while maintaining added work?

So the scenario is as such:

I needed to do work for a feature I'm implementing called "split". I created a branch called split and did all of my work on it.

In the meantime, there was a breaking change that needed implementation in production, so I switched back to master, committed my changes, and deployed them.

Now I'm back to working on the 'split' branch. I checked it back out this morning, but now I need to bring it up to speed with the master branch which contains the breaking changes that I implemented.

How can I do this?

Answer

git rebase master and then resolve the conflicts and you are done. But this should only be done on non-pushed local branches that no other users have work based on. If potentially others have branches based on your branch, you should better merge the lastest master changes into your feature branch, but with rebase you get nicer linear history instead of ladder history.

Comments