$30 off During Our Annual Pro Sale. View details »

Git Rebase vs. Merge

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
Tweet

More Decks by Miha Rekar

Other Decks in Programming

Transcript

  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’

  9. EXAMPLE

  10. REAL WORLD EXAMPLES

  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