-
Notifications
You must be signed in to change notification settings - Fork 0
Rebasing
Dave Anderson edited this page Aug 1, 2013
·
5 revisions
Rebase changes modifies a series of commits to start from a later commit then they originated from. The common example is when you branch off the master branch and the master branch moves ahead in parallel to your branch work.
# master -> D254644; HEAD -> master
git checkout -b abranch # abranch -> master -> D254644; HEAD -> abranch
git add . # G154547 commit-tree created; G154547.parent -> D143424
git commit -m "abranch work" # abranch -> G154547
git checkout master # HEAD -> master
git add . # J154510 commit-tree created; J154510.parent -> D143424
git commit -m "master work" # master -> J154510
git checkout abranch # HEAD -> abranch
git rebase master # G154547 changes are calculated off of J154510 into new L141211
# L141211.parent -> J154510; abranch -> L141211
git checkout master # HEAD -> master
git merge abranch # master -> L141211
This rebase changes the way the master merged in the branch. What was bound to be a composite merge is now a simple fast-forward merge.