Skip to content

Instantly share code, notes, and snippets.

@kblin
Created June 15, 2010 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kblin/439745 to your computer and use it in GitHub Desktop.
Save kblin/439745 to your computer and use it in GitHub Desktop.
start: my_branch diverges from master at commit A, master HEAD is B
-------X---Y--Z my_branch
/
--------------A-----------B master
Now, you cherry-pick over Y, because it's a bug fix or the like..
(And some more patches)
-------X---Y--Z my_branch
/
--------------A-----------B-Y--C master
now I do git rebase master
1. my_branch is detached from master
-------X---Y--Z my_branch
--------------A-----------B-Y--C master
(2. the "fork" of the trees is moved forward from A to C)
-------X---Y--Z my_branch
/
--------------A-----------B-Y--C master
3. the patches from my_branch are re-applied on top of B
While doing this, git notices Y is already in master, and skips it
-------X-----Z my_branch
/
--------------A-----------B-Y--C master
start: my_branch diverges from master at commit A, master HEAD is B
-------X my_branch
/
--------------A-----------B master
now I do git rebase master
1. my_branch is detached from master
-------X my_branch
--------------A-----------B master
(2. the "fork" of the trees is moved forward from A to B)
-------X my_branch
/
--------------A-----------B master
3. the patches from my_branch are re-applied on top of B
-------X my_branch
/
--------------A-----------B master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment