Git Troubleshooting
Cheat sheet · https://pcornel.dk/topic.php?topic=5480
Answer
Git Troubleshooting isolates failures across repository state, refs/history, worktree/index, remote configuration, transport/authentication, server policy and downstream automation without destroying recoverable evidence.
Remember
- Command error ≠ repository corruption; many failures originate in state, permissions, remote policy or transport.
- Changed symptom ≠ root cause fixed; a retry can succeed after transient conditions without explaining the boundary.
- Reset/clean success ≠ safe recovery; destructive commands can erase the evidence or work that explained the issue.
- Remote rejection ≠ local Git bug; authentication, authorization, protected refs and server hooks are independent boundaries.
First checks
git status; git log --oneline -5— stategit reflog— recover lost commitsGIT_TRACE=1 git <cmd>— debug
Commands
git status --short --branch- Read-only/validation observation for current branch, working-tree changes and divergence indicators.
Verify in this order
symptom → git state → reflog/trace → fix
Where it usually breaks
A Git command succeeding after a change proves only that operation now passed. Root cause closes when the first failed boundary is explained and local/remote state plus downstream effects are verified.
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Git Troubleshooting Git boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Local state | Repository, HEAD, worktree/index and commit IDs are explicit | Wrong repo/ref, hidden staged/untracked state or mutable-name ambiguity |
| History / refs | Ancestry and branch/tag movement match intent | Unexpected rewrite, stale tracking ref or unclear merge base |
| Remote sync | URL/refspec, auth and remote read-back match expected commits | Local assumptions, rejection, stale fetch or unsafe force update |
| Downstream proof | Build/reconciliation/target is verified independently | Push/tag/merge success treated as deployment success |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5480