Git rebase explained

2,832 views

Published on

Git rebase is most useful yet difficult to understand operation in git. Rebase helps one to keep commit history linear. This document explains what is rebase and how it affect commit history.

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,832
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Git rebase explained

  1. 1. GiT rebase Explained.. -Mahesh Vaidya mvaidya@awanitech.com +91-9740500144
  2. 2. Purpose: Transplant range of commits from another branch. Alternatives: GiT merge Disadvantage: ● Multi parent commit ● Good SCM policies should NOT allow merge commit Push GiT Rebase
  3. 3. topic_branch off master branch GiT Rebase master topic_branch
  4. 4. topic_branch and master advanced. (divergence) GiT Rebase master topic_branch C-1
  5. 5. master advanced. (More divergence) GiT Rebase master topic_branch C-1 C-2
  6. 6. Bring changes from master As said earlier no merges please !! option is transplant changes introduced in C-1 and C-2 respectively. Think rebase a cherry-pick over a range of commits. This keeps history linear and less graph traversal cost. Easier history to for human use.
  7. 7. Move topic branch as if it is created off commit C-1 GiT Rebase master topic_branch C-1 C-2
  8. 8. Move topic branch as if it is created off commit C-2 GiT Rebase master topic_branch C-1 C-2
  9. 9. Operational Notes. Same merge conflict reappears: In git command line use 'git rerere' to save previous merge decisions. Want to kill this rebase for now: git rebase --abort
  10. 10. Operational Notes. Stage the merge conflicts: git add <filename> Complete this rebase: git rebase --continue

×