Merge vs rebase
Understand history before making it tidy.
Merge joins histories
A normal merge preserves existing commits and, when branches diverged, creates a merge commit with both histories as parents. A fast-forward just moves a pointer.
git switch feature/menu
git merge mainRebase replays commits
Rebase takes commits from your branch and reapplies them on another base, usually producing new commit identities. The working changes can be similar while the history shape differs.
git switch feature/menu
git rebase mainDo not surprise other people
Avoid rebasing commits other people already depend on unless your team explicitly coordinates it. Do not force-push just to make a graph look cleaner. Private feature work and shared history need different judgment.
Conflict recovery belongs to the operation
For a paused rebase, edit, stage and rebase --continue. Rebase --abort backs out of the rebase. Merge uses merge --abort; do not mix them up.
git add RESOLVED_FILE
git rebase --continue
# Or choose to cancel the operation:
git rebase --abortQuick check
Which operation generally rewrites commit identities?
Choose an answer.
Sources and scope
Command blocks are syntax examples checked against official documentation, not fabricated terminal output. Replace uppercase placeholders with your actual names and inspect status before commands that change work.
git-merge · git-rebase ·