Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git Rebase vs. Merge

5a5fcbae333f071dc7a28f4958509db5?s=47 Miha Rekar
October 21, 2014

Git Rebase vs. Merge

Quick tech talk I did for my team members.

Always pull with rebase: http://stevenharman.net/git-pull-with-automatic-rebase

Read more:
- git docs: git-rebase - http://git-scm.com/docs/git-rebase
- git docs: git-merge - http://git-scm.com/docs/git-merge
- git book: Rebasing - http://git-scm.com/book/en/Git-Branching-Rebasing
- git book: Basic Branching and Merging - http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging)


Miha Rekar

October 21, 2014


  1. GIT rebase vs. merge

  2. CURRENT STATE C0 C1 C2 master

  3. NEW BRANCH C3 new_feature C0 C1 C2 master

  4. CHANGES ON MASTER C3 new_feature C4 C0 C1 C2 master

  5. MERGE C3 new_feature C4 C0 C1 C2 master C5

  6. PREVIOUS STATE C3 new_feature C4 C0 C1 C2 master

  7. REBASE C3 new_feature C4 C0 C1 C2 master C3’

  8. FAST-FORWARD MERGE new_feature C4 C0 C1 C2 master C3’



  11. REBASE VS. MERGE + flat and readable history + simple

    single commit manipulation + intuitive - more complex - can be dangerous - rewriting history + simple to use + maintains original context - create clutter when multiple people on the same branch - intensely polluted history with merge commits - harder to use git-bisect
  12. CONCLUSION • rebase when possible • rebase PR before merging

    • merge PR on GitHub • always pull with rebase: http://stevenharman.net/git- pull-with-automatic-rebase