| git merge | git rebase |
|---|
| Joins two branches, usually with a merge commit | Moves your commits on top of another branch |
| Keeps the real history as it happened | Rewrites commits (new hashes) for a straight line |
| Safe on shared branches | Should not be used on pushed, shared commits |
| Conflicts are solved once | Conflicts may appear for each replayed commit |
A common rule: rebase your own local feature branch to update it, and merge when the branch goes back to main. See Git Merge and Git Rebase.
Learn more about the similar topics:
| Tutorials |
| No Content Found. |
| Exercises & Assignments |
| No Content Found. |
| Interview Questions & Answers |
| No Content Found. |