`fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.`
BeginnerTroubleshootingLost Work, HEAD and History Problems
Answer
Likely causes → The repo has only one commit, so there is no parent; or you are in a shallow clone, or the revision was misspelt.
Diagnose →
git rev-list --count HEAD
git rev-parse --is-shallow-repository
Fix → In a one-commit repo, use git update-ref -d HEAD to undo the first commit (keeps files staged), or git commit --amend. For shallow clones: git fetch --deepen=10.
Prevent → Use fetch-depth: 0 in CI jobs that need history.
More on Lost Work, HEAD and History Problems
`fatal: Unable to create '/repo/.git/index.lock': File exists.`BeginnerYou added a file to `.gitignore`, but `git status` still shows it as modified.Beginner`fatal: your current branch 'main' does not have any commits yet`Beginner`Author identity unknown *** Please tell me who you are.` and `fatal: unable to auto-detect email address`BeginnerYour commits do not show on your GitHub profile contribution graph.Intermediate`fatal: 'main' is already checked out at '/home/dev/app-hotfix'`Intermediate