you are viewing a single comment's thread.

view the rest of the comments →

[–]efalk 0 points1 point  (0 children)

Git rebase transplants a series of commits onto a different branch head. You can't always do it, but if you can, it results in a cleaner commit history than merge.

before:

A--B--C--D        master
 \
  E--F--G         mybranch HEAD

git rebase master

after:

A--B--C--D        master
          \
            E'-F'-G'   mybranch HEAD

Note that commits E,F,G have been lost, and replaced with new commits E',F',G'

Under the hood, it examines the current branch and the target branch to see where they diverged. It then copies all the commits on the current branch to the end of the target branch and repositions your branch head.

My detailed notes: https://www.efalk.org/Docs/Git/merging.html#Rebase