git
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| git [2026/06/16 00:09] – [diff] jhagstrand | git [2026/06/16 00:13] (current) – [diff] jhagstrand | ||
|---|---|---|---|
| Line 275: | Line 275: | ||
| Use diff to find the differences between two commits.\\ | Use diff to find the differences between two commits.\\ | ||
| - | git diff 1bde095 b0ba90d # compare two commits | + | git diff 1bde095 b0ba90d |
| - | git diff master sidebar | + | git diff master sidebar |
| - | git diff master sidebar | + | git diff master sidebar hud.js |
| By default diff compares all of the currently modified files. | By default diff compares all of the currently modified files. | ||
| Line 288: | Line 288: | ||
| git diff master sidebar --stat | git diff master sidebar --stat | ||
| - | | ||
| git diff -U0 # do not display context | git diff -U0 # do not display context | ||
| - | | + | |
| + | Whitespace.\\ | ||
| + | In .gitconfig, add | ||
| + | [core] whitespace = -trailing-space, | ||
| git diff -w # ignore whitespace | git diff -w # ignore whitespace | ||
| git diff -w --word-diff-regex=[^[: | git diff -w --word-diff-regex=[^[: | ||
| - | |||
| Dots.\\ | 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.)\\ | 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 | git diff master..sidebar poker.js | ||
| git diff master...sidebar poker.js | git diff master...sidebar poker.js | ||
| - | |||
| - | Warning! Two dots vs three dots makes a difference, and the difference is reversed in git diff vs git log. | ||
| Double hyphens.\\ | Double hyphens.\\ | ||
| I don't know why this is used.\\ | I don't know why this is used.\\ | ||
| - | git diff master sidebar | + | git diff master sidebar hud.js |
| - | git diff master sidebar -- html/js/hud.js | + | git diff master sidebar -- hud.js |
| - | git diff master sidebar | + | git diff master sidebar hud.js -- |
| - | + | ||
| - | In .gitconfig, add | + | |
| - | [core] whitespace = -trailing-space, | + | |
| ====log==== | ====log==== | ||
git.1781582976.txt.gz · Last modified: 2026/06/16 00:09 by jhagstrand