All tags
diff
Narrow down
Git19
- Tip
git log --stat -5git log --stat shows which files each commit touchedList commits together with a per-file summary of what changed3 Dec 2026 - Tip
diff -r -x .git -x '*.log' one twodiff -r -x skips folders and files you don't care aboutLeaves out files and folders matching a pattern when comparing two directories recursively.3 Dec 2026 - Tip
git difftool --dir-diffgit difftool --dir-diff opens all changed files in one diff windowOpens your visual diff tool once with two folders to compare, instead of once per changed file.2 Dec 2026 - Tip
git stash show -p stash@{1}git stash show -p shows what is inside a stash before you apply itPrints the full diff of a stash, so you know what you are about to bring back.30 Nov 2026 - Tip
git diff -wgit diff -w hides changes that are only whitespaceLeaves out indentation and spacing changes so you can read the real edits.30 Nov 2026 - Tip
git diff --no-index old.conf new.confgit diff with no-index compares two files outside a repositoryGives you git's colored diff for any two files or folders, even outside a repository.30 Nov 2026 - Tip
git diff main -- . ':(exclude)vendor'git log and diff can leave a folder out with an exclude pathspecHides vendored or generated folders from log and diff with a pathspec.30 Nov 2026 - Tip
git diff main...featuregit diff with three dots shows only what your branch changedCompares your branch with the point where it left main, so other people's work stays out.30 Nov 2026 - Tip
git diff --dirstat main...HEADgit diff with dirstat shows which folders a change touched mostGives a percentage per folder, so you see where a big change really happened.30 Nov 2026 - Tip
git diff main@{yesterday} maingit diff main@{yesterday} compares a branch with how it was earlierUses the reflog to compare a branch with its state at an earlier time on your machine.30 Nov 2026 - Tip
git apply --check wip.patchgit apply with check tests a patch before it touches your filesSaves uncommitted work as a patch file and checks that it applies cleanly elsewhere.30 Nov 2026 - Tip
git add -N src/export.pygit add -N makes a new file show up in git diffRegisters a new file without staging its content, so diffs and add -p see it.30 Nov 2026 - Tip
git diff HEADgit diff HEAD shows staged and unstaged changes togetherCompares your working tree with the last commit, staged or not.30 Nov 2026 - Tip
git config --global merge.conflictStyle zdiff3Merge.conflictStyle zdiff3 shows the common ancestor in conflictsAdds the original text to merge conflicts so you can see what each side changed.28 Nov 2026 - Tip
git diff --diff-algorithm=histogramDiff.algorithm histogram for diffs that read betterSwitches Git's diff algorithm so moved or repetitive code can show up as cleaner hunks.28 Nov 2026 - Tip
git diff --checkgit diff --check catches whitespace errors and conflict markersWarns about trailing whitespace and leftover conflict markers in your changes.28 Nov 2026 - Tip
git diff --color-movedgit diff --color-moved shows code that only movedColors moved lines differently in a diff, so real edits stand out during a review.27 Nov 2026 - Tip
git diff --word-diffRead a small edit in a long line with git diff --word-diffShows changes word by word instead of line by line.12 Oct 2026 - Tip
git diff --stagedgit diff --staged shows what your commit will containShows the changes that are staged and will go into your next commit.26 Jul 2026
Other tips6
- Tip
patch -R g.txt < f.patchpatch -R undoes a patch you appliedReverses a patch, so the files go back to how they were before it was applied.3 Dec 2026 - Tip
diff -Naur original/ changed/ > fix.patchdiff -Naur makes a patch that also adds and removes filesCreates a patch of a whole folder that includes new and deleted files, not only changed ones.30 Nov 2026 - Tip
patch -p1 --dry-run < ../fix.patchTest a diff with a patch dry run before it changes any fileTests a patch file against your folder first, so a failed patch doesn't leave half-changed files.30 Nov 2026 - Tip
diff --strip-trailing-cr windows.txt unix.txtdiff can ignore Windows line endings with one optionCompares a Windows file with a Unix file without every line showing up as changed.30 Nov 2026 - Tip
diff -I '^# generated' old/app.conf new/app.confdiff -I skips lines that match a pattern, like timestampsLeaves out changes in lines such as generated dates, so two exports can be compared.30 Nov 2026 - Tip
diff -b old.conf new.confdiff -b ignores changes in the amount of whitespaceHides differences that are only extra or fewer spaces, so the real changes stand out.30 Nov 2026
Shell2
- Tip
diff -y -W 100 old.conf new.confdiff -y shows two files side by side in the terminalPuts two versions next to each other in columns, which is easier to read for short config files.30 Nov 2026 - Tip
diffdiff <(cmd1) <(cmd2) compares output without temp filesCompares the output of two commands directly, without saving them to temporary files.10 Oct 2026
Network1
Storage1
Nothing matches.