Branching and mergingmedium3-5 years

During an interactive rebase, a developer hits a conflict, looks at the `<<<<<<< HEAD` block, and — out of habit from resolving merge conflicts — keeps that side every time. The result quietly discards their own work. What went wrong?

HEAD means opposite things in a merge and a rebase, and "keep HEAD" is a habit that's only safe in one of them. During a normal merge, you're on your own branch and HEAD is your side of the conflict. During a rebase, Git detaches and checks out the target branch first, then replays your commits onto it one at a time — so while resolving a rebase conflict, HEAD is the branch being rebased onto (typically main), and your own change is the bottom half of the markers, labelled with a commit hash instead of a branch name. Reflexively keeping HEAD during a rebase means keeping main's version and discarding your own — exactly backwards from what the developer intended.

The lesson behind it →
More on Branching and merging