Lingquan | Blog

Differece between rebase and merge in Git

Word count: 136Reading time: 1 min
2019/01/16 Share

When to merge?

We need merge branch with master when we finish new features or modificatin in our own braches.We can use git merge and git rebase.

Difference

  1. git log will be different: merge will not remain the commits in branch.
  2. git operation and effect is different:

    • If we use git merge:

    After we solve the confilct, then we use git add . and git commit - m “fix confilct” .A commit will be produce to record the merge.

    • If we use git rebase:

    After we solve confilcts, then we then we use git add . and git rebase –continue . No extra commit is produced, which makes log more clean. However, if branch has many commits, we need to fix conflict for serveral times.Therefore, a better way is to use git commit –amend to use one commit.

CATALOG
  1. 1. When to merge?
  2. 2. Difference