Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 893 Bytes

11.md

File metadata and controls

39 lines (27 loc) · 893 Bytes

Git: beyond the basics

Rebasing

  • Re-apply a series of commits to a different initial parent commit.
  • Alters the commit history since all parent commits and timestamps will be altered.
  • Results in a cleaner commit history with fewer merge commits.
  • Can still result in conflicts just like merging.

When to rebase?

  • You are the only person working on the branch.
  • You want to eventually be able to do a fast-forward merge of this branch back into another branch.

From man git-rebase

Assume the following history exists and the current branch is "topic":

             A---B---C topic
            /
       D---E---F---G master

From this point, the result of either of the following commands:

   git rebase master
   git rebase master topic

would be:

                     A'--B'--C' topic
                    /
       D---E---F---G master

back