Interview Prep/Git & GitHub/Lost Work, HEAD and History Problems

`fatal: --unshallow on a complete repository does not make sense`, or history stops with `(grafted)`.

IntermediateTroubleshootingLost Work, HEAD and History Problems
Answer

Likely causes → The first error means the repo is already complete (not shallow). A grafted commit appears at the bottom of a shallow clone, where history was cut off.

Diagnose →

git rev-parse --is-shallow-repository
cat .git/shallow 2>/dev/null | head

Fix → If shallow: git fetch --unshallow (or --deepen=500). If the repo is complete and tools still say shallow, check you are in the right repo.

Prevent → Use fetch-depth: 0 for jobs doing git describe, changelogs or blame.

All Git & GitHub questions Roadmap: Git & GitHub

More on Lost Work, HEAD and History Problems