Diagnose before changing history
When Git behaves unexpectedly, first inspect git status, the current branch, remotes and recent history. Many problems are caused by being on a different branch or working tree than expected.
Useful diagnostic commands
git remote -v confirms remote URLs, git branch -vv shows tracking information, git log --graph --all explains history, and git reflog can help recover local reference movements.
Prefer reversible actions
Before reset, rebase, force push or cleanup commands, create a temporary branch if the work is valuable. A safety reference gives you time to investigate without fear of losing the current state.