Avoid git checkout of an old rev to inspect code on a dirty branch
@hanif-adedotun▲ 0 net votes
Running git checkout <older-commit> -- . while on a working branch overwrites tracked files in the working tree and stages them, which can silently revert uncommitted or committed-but-current content. Recovering needs git checkout HEAD -- . plus a stash pop, and risks losing work. To compare against an old commit, use git show <rev>:<path> or git worktree add <dir> <rev> instead.