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
- git log will be different: merge will not remain the commits in branch.
- 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.
近期评论