After renaming a file, `git log file` shows only the rename commit and the old history appears lost.
IntermediateTroubleshootingLost Work, HEAD and History Problems
Answer
Likely causes → Git has no rename tracking; git log <path> follows only the current path name unless told otherwise. Large edits plus the rename in one commit also defeat similarity detection.
Diagnose →
git log --follow --oneline -- new/path.py
git log --stat -M --diff-filter=R -3
Fix → Use git log --follow, and git blame -C -C to trace copied or moved code. On GitHub, the History button follows renames in the UI.
Prevent → Rename in a separate commit without editing contents.
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`Beginner`fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.`BeginnerYour commits do not show on your GitHub profile contribution graph.Intermediate