merge and rebase

The difference of merge and rebase

rebase


rebase process

  
  feature S01 and S02 created in node A(dev)
  SO1 commit once and in node B
  S02 commit once and in node C
  
  check in S02 and rebase S01 to S02
  it seems that S02 created in node B rather than A
  then C
  before
  S02 A -> C
  now
  S02 A -> B -> C'

diff

  1. merge will always generate a ‘merge’ commit () when –no-ff
    but rebase will not, it seems that fast-forward every time
  2. rebase means that updates current up stream, then changes current commits
  3. ‘merge’ commits is easier to distinguish when update upstream and rolling back is easier.
    However, the merge commit that dev is merged to feature looks complex.

roll back

 git checkout mybranch # if needed
 git reset --hard ooooooo  # or mybranch@{1}

stackoverflow.com/undoing-a-git-rebase

stackoverflow.com/undo-git-rebase

recommend

merge is recommend because when co-work, the ‘merge’ commits is easier to distinguish which feature

cherry-pick rebase children interactively

cherry-pick, merge, rebase

git rebase的原理之多人合作分支管理

git rebase介绍

git-scm-cn

git-scm-en

你可能感兴趣的:(git)