<- Back
#vcs
#history
#changes
git diff
Show changes
Unstaged changes
git diff
Staged changes
git diff --staged
Both (unstaged and staged) changes
git diff HEAD
History
Diff from yesterday
git diff @{yesterday}..HEAD
Changes of the last six weeks
git diff @{6 weeks ago}..HEAD
Changes between branches
Summary (filenames and amount of changes)
git diff --compact-summary branch..master
| Description | Shortcut |
|---|---|
| Jump to next file | n |
| Jump to previous file | N |
Single file
Show file at commit hash
git show 24a255c1:src/main.rs
Show file at absolute date
git show HEAD@{2013-02-25}:src/main.rs
Show file at relative date
git show HEAD@{3 days ago}:src/main.rs
For date older than 90 days
git show (git rev-list -1 --before="2024-07-13" HEAD):src/main.rs
Restore file to previous version at revision
git checkout 24a255c1 -- src/main.rs