User Tools

Site Tools


git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
git [2026/06/16 00:09] – [diff] jhagstrandgit [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   # compare two commits 
-  git diff master sidebar  # compare two branches +  git diff master sidebar    # compare two branches 
-  git diff master sidebar html/js/hud.js  # compare two versions of a file+  git diff master sidebar hud.js  # compare two versions of a file
  
 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   # show filenames and counts only   git diff master sidebar --stat   # show filenames and counts only
-   
   git diff -U0 # do not display context   git diff -U0 # do not display context
-  + 
 +Whitespace.\\ 
 +In .gitconfig, add  
 +[core] whitespace = -trailing-space,-indent-with-non-tab,-tab-in-indent 
   git diff -w # ignore whitespace   git diff -w # ignore whitespace
   git diff -w --word-diff-regex=[^[:space:]] # ignore whitespace additional   git diff -w --word-diff-regex=[^[:space:]] # ignore whitespace additional
- 
  
 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  # compare changes from latest master to latest sidebar   git diff master sidebar poker.js  # compare changes from latest master to latest sidebar
   git diff master..sidebar poker.js  # same as no dots   git diff master..sidebar poker.js  # same as no dots
   git diff master...sidebar poker.js  # not latest master but master when sidebar branched   git diff master...sidebar poker.js  # not latest master but master when sidebar branched
- 
-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 html/js/hud.js +  git diff master sidebar hud.js 
-  git diff master sidebar -- html/js/hud.js +  git diff master sidebar -- hud.js 
-  git diff master sidebar html/js/hud.js -- +  git diff master sidebar hud.js --
- +
-In .gitconfig, add  +
-[core] whitespace = -trailing-space,-indent-with-non-tab,-tab-in-indent +
  
 ====log==== ====log====
git.1781582976.txt.gz · Last modified: 2026/06/16 00:09 by jhagstrand

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki