ShareYourGroupShareYourGroupGit Help

See what I changed before I commit

I want to review my changes before committing.

The problem

I want to review my changes before committing.

How the practice repository looked before

$ git status --short --branch
## main
A  new.txt
 M notes.txt
$ git log --oneline -5
3830e39 Add line two
57480f3 Add notes

The fix

$ git status --short
A  new.txt
 M notes.txt
$ git diff
diff --git a/notes.txt b/notes.txt
index e5c5c55..f2873ca 100644
--- a/notes.txt
+++ b/notes.txt
@@ -1,2 +1,3 @@
 line one
 line two
+line 3
$ git diff --staged
diff --git a/new.txt b/new.txt
new file mode 100644
index 0000000..fa49b07
--- /dev/null
+++ b/new.txt
@@ -0,0 +1 @@
+new file

Why this works

git diff shows changes that are not staged. git diff --staged shows what the next commit will contain. Untracked files appear in neither until you add them.

If this is not quite your case

Add --stat for a summary of files and line counts, or a file name to look at one file. git diff HEAD shows staged and unstaged changes together against the last commit. Reading the diff before every commit is the cheapest way to avoid committing debug lines by accident.

This is an independent guide. It is not connected with the Git project, GitHub, GitLab or any company named here. Every command below was run on 14 November 2026 with the real program (git version 2.56.0.windows.4) in a new empty practice repository; the output shown is what it printed. Facts about options were read in the official Git documentation on 14 November 2026.