Interview Prep/Git & GitHub/Merge and Rebase Problems

`error: could not read '.git/rebase-merge/head-name': No such file or directory`

AdvancedTroubleshootingMerge and Rebase Problems
Answer

Likely causes → Rebase state is inconsistent: the rebase directory was partly deleted, a second Git process interfered, or a crash corrupted it.

Diagnose →

ls -la .git/rebase-merge .git/rebase-apply 2>/dev/null
git status
git reflog -15

Fix → Record the pre-rebase tip from the reflog (rebase (start) entry, minus one). Remove the broken state (rm -rf .git/rebase-merge), then git switch <branch> and git reset --hard <pre-rebase-sha>. Redo the rebase carefully.

Prevent → Do not run IDE Git actions and terminal Git commands in parallel during a rebase.

All Git & GitHub questions Roadmap: Git & GitHub

More on Merge and Rebase Problems