GNU/Linux Desktop Survival Guide
by Graham Williams |
|||||
Git Merge |
20200908 A pull will do a fetch followed by a merge. A merge will update the local repository to incorporate the current updates from the remote repository.
An alternative to doing a merge is to do a rebase which updates the local repository changes to be based on the sequence of updates from the remote repository. Hence it is rebased!
That is, a fetch:
- o - o - o - H - A - B - C (main) \ P - Q - R (origin/main) |
A merge:
- o - o - o - H - A - B - C - X (main) \ / P - Q - R --- (origin/main) |
- o - o - o - H - P - Q - R - A' - B' - C' (main) | (origin/main) |
C' and X should be identical. The history will look different.
A merge is probably better than a rebase in the case where someone else has pulled from your main branch.