When do you use Git rebase instead of Git merge?

后端 未结 17 2366
独厮守ぢ
独厮守ぢ 2020-11-21 11:25

When is it recommended to use Git rebase vs. Git merge?

Do I still need to merge after a successful rebase?

17条回答
  •  余生分开走
    2020-11-21 12:17

    Before merge/rebase:

    A <- B <- C    [master]
    ^
     \
      D <- E       [branch]
    

    After git merge master:

    A <- B <- C
    ^         ^
     \         \
      D <- E <- F
    

    After git rebase master:

    A <- B <- C <- D' <- E'
    

    (A, B, C, D, E and F are commits)

    This example and much more well illustrated information about Git can be found in Git The Basics Tutorial.

提交回复
热议问题