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

`git filter-repo` aborts: `Aborting: Refusing to destructively overwrite repo history since this does not look like a fresh clone.`

IntermediateTroubleshootingLost Work, HEAD and History Problems
Answer

Likely causes → filter-repo's safety check found signs of an existing working repo (remote-tracking refs, stash, reflog, multiple packs).

Diagnose →

git count-objects -v
git stash list
git for-each-ref | head

Fix → Work on a fresh clone made for the rewrite: git clone --no-local /path/to/repo rewrite && cd rewrite. Use --force only if you have a verified backup.

Prevent → Always run history rewrites on a throwaway clone and keep the original until verified.

All Git & GitHub questions Roadmap: Git & GitHub

More on Lost Work, HEAD and History Problems