git
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| git [2026/06/15 01:57] – [log] jhagstrand | git [2026/06/16 00:13] (current) – [diff] jhagstrand | ||
|---|---|---|---|
| Line 273: | Line 273: | ||
| ====diff==== | ====diff==== | ||
| - | Use diff to find the differences between two branches or between two files.\\ | + | Use diff to find the differences between two commits.\\ |
| - | Note that there is a big difference between .. and ... between the two commit designations.\\ | + | |
| - | Also the two hyphens -- can go before or after the filename and that alters the output.\\ | + | |
| - | git diff master...featurebranch | + | |
| - | | + | |
| - | git diff 1bde095..b0ba90d -- html/js/hud.js | + | git diff master sidebar |
| By default diff compares all of the currently modified files. | By default diff compares all of the currently modified files. | ||
| Line 289: | Line 287: | ||
| Additional options. | Additional options. | ||
| + | git diff master sidebar --stat | ||
| git diff -U0 # do not display context | git diff -U0 # do not display context | ||
| - | | ||
| - | git diff -w # ignore whitespace | ||
| - | git diff -w --word-diff-regex=[^[: | ||
| + | Whitespace.\\ | ||
| In .gitconfig, add | In .gitconfig, add | ||
| [core] whitespace = -trailing-space, | [core] whitespace = -trailing-space, | ||
| + | git diff -w # ignore whitespace | ||
| + | git diff -w --word-diff-regex=[^[: | ||
| + | |||
| + | Dots.\\ | ||
| + | If both master and sidebar have changed, and you want to see only differences in sidebar, use three dots. (This is a shortcut to naming the commit specifically.)\\ | ||
| + | Warning! Two dots vs three dots makes a difference, and the difference is reversed in git diff vs git log.\\ | ||
| + | |||
| + | git diff master sidebar poker.js | ||
| + | git diff master..sidebar poker.js | ||
| + | git diff master...sidebar poker.js | ||
| + | |||
| + | Double hyphens.\\ | ||
| + | I don't know why this is used.\\ | ||
| + | |||
| + | git diff master sidebar hud.js | ||
| + | git diff master sidebar -- hud.js | ||
| + | git diff master sidebar hud.js -- | ||
| ====log==== | ====log==== | ||
| Line 305: | Line 319: | ||
| git log --all --oneline --graph --decorate | git log --all --oneline --graph --decorate | ||
| git log --oneline -10 # topmost n lines | git log --oneline -10 # topmost n lines | ||
| + | git log --all --pretty=fuller | ||
| ==== interactive rebase ==== | ==== interactive rebase ==== | ||
git.1781503061.txt.gz · Last modified: 2026/06/15 01:57 by jhagstrand