Reputation: 12295
I'm following a workflow similar to the one describe by Scott Chacon in his Pro Git book and illustrated in 3.2 Git Branching.
I have created a branch (following along from Scott's example) iss53
. I've done work on that branch, but then need to switch gears and tackle a new issue. I create branch hotfix
. Commits are added to hotfix
and then merged back into master
:
In Scott's example he doesn't need to take the commit from hotfix
(C4) and apply it to iss53
, but say I do.
How can I update my feature branch so that it appears to have been branched from a later commit?
Effectively, I want to update iss53
so that it looks like this:
Update:
After researching this further, this article was what I was looking for to explain merging vs rebaseing: http://blog.sourcetreeapp.com/2012/08/21/merge-or-rebase/
Upvotes: 1
Views: 289
Reputation: 46037
Use rebase which is explained after few pages in the same book.
$ git checkout iss53
$ git rebase master
Note that, rebase should be avoided if branch iss53 is pushed to a remote that other people can access.
Upvotes: 2