Choose a Git command from the change you want to inspect, not from a list of commands to try. Staged edits, unstaged edits, untracked files and committed history are different things. This guide points to focused walkthroughs for each case, with a short diagnostic before you change anything.
Start inside your repository:
git status --short
git diff --stat
git diff --cached --stat
These inspect the current state. They do not clean your working folder, switch branches or rewrite commits. An empty diff is not proof that you have no work: the comparison may simply exclude the changes you are looking for.
A file is staged, but it should not be in the next commit
Use the guide to unstaging a file without losing its edits. This is for a change that should remain on disk while you decide what to commit. It is different from discarding changes or removing a tracked file from future snapshots.
Before running a command, identify the exact path and review its cached diff. Use the path separator -- and quote filenames containing spaces. The walkthrough covers new files and partial staging as well as ordinary tracked edits.
git diff is empty after git add
The default diff compares your working copy with the index. After staging a whole file, those versions can match even though the index differs from your current commit. Read why git diff is empty after git add to choose the right comparison.
Try git diff --cached -- your-file to inspect the staged patch. This does not require staging again or resetting anything. For the full distinction, consult the official diff reference.
A file still appears after adding it to .gitignore
Ignore rules do not make an already tracked file disappear from the index. The tracked-file ignore walkthrough helps distinguish an unmatched pattern from an already tracked path.
Stopping tracking a configuration file changes future commits and can affect collaborators when they pull. It also does not erase an old secret from repository history. If credentials were committed, treat rotation and history cleanup as separate work; an ignore rule is not a security fix.
git stash says there are no local changes
First check whether the files are tracked, untracked or ignored. The untracked-file stash guide explains why a normal stash can omit the work you see in your folder.
Review what would be included before widening a stash operation. Ignored build output and local settings may be large or sensitive. Avoid adding extra flags merely to suppress a confusing message.
You want to remove generated files, but need a preview first
Use the git clean dry-run guide before any deletion. Read the candidate paths and check ignored-file behavior. The preview is an opportunity to stop, not a promise that everything shown is safe to delete.
Untracked files can contain work that Git has never stored. A clean operation is different from unstaging a tracked edit and is not a general repair command.
You need to compare branches without disturbing local work
The branch-comparison walkthrough compares committed snapshots without checking either branch out. It separates an endpoint comparison from a three-dot merge-base comparison.
Choose the question first: do you want the difference between two branch tips, or the changes on one side since a shared base? Local references may be stale; a read-only comparison does not automatically fetch newer remote history.
You need the commit that last changed a line
Use the line-history guide using git blame, then inspect the resulting commit patch. Line attribution is a starting point for investigation, not proof that its author caused a bug.
Whitespace-only changes, renames and local edits can change what you see. The walkthrough shows how to narrow the line range and compare against committed content.
When to stop and inspect further
If short status reports an unresolved conflict, or a command refuses to overwrite a differing staged version, do not force it to match a tutorial. Inspect the index and working copy first. The status output reference explains the columns and conflict states; git restore documents the difference between restoring the index and restoring working files.
Pick the single walkthrough that matches your current state. Keeping a narrow path and reviewing the proposed patch is more useful than running several unrelated cleanup commands.




