merge and rebase are two command that are designed to integrate changes between two branches
They have one difference:
Imagine this commit history (log) 1) with a remote and a local branch where the commit in the remote branch will be integrated into the local branch.
- A - B - C - D - remote HEAD
\
E - F - G - local HEAD
After a merge, the commit history (log) will look like:
- A - B - C - D - remote HEAD
\ \
E - F - G - local HEAD - new local HEAD
After a rebase, the commit history (log) will look like:
- A - B - C - D - remote HEAD - E' - F' - G' - local HEAD'
There is a trade-off: