User Tools

Site Tools


git_whitespace

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git_whitespace [2018/06/11 11:06]
rpjday [git rebase]
git_whitespace [2019/03/05 18:15] (current)
rpjday [git blame]
Line 1: Line 1:
 ===== Overview ===== ===== Overview =====
  
- A moderately (dis)organized list of features related to dealing with whitespace issues in Git, in no particular order.+ A moderately (dis)organized list of features related to dealing with whitespace issues in Git, in no particular order. ​It's a matter of some debate whether EOL standardization is simply a subet of whitespace issues, or whether it deserves its own page. 
 + 
 +===== config options ===== 
 + 
 +==== apply.ignoreWhitespace ==== 
 +==== apply.whitespace ==== 
 +==== core.whitespace ==== 
 + 
 +<​code>​ 
 +$ git config --global core.whitespace \ 
 +    trailing-space,​-space-before-tab,​indent-with-non-tab,​tab-in-indent,​cr-at-eol 
 +</​code>​ 
 +==== core.eol ==== 
 +==== core.safecrlf ==== 
 +==== core.autocrlf ==== 
 + 
 +Setting this variable to "​true"​ is the same as setting the text attribute to "​auto"​ on all files and core.eol to "​crlf"​. Set to true if you want to have CRLF line endings in your working directory and the repository has LF line endings. This variable can be set to input, in which case no output conversion is performed. 
 + 
 +===== git apply ===== 
 + 
 +TO DO. 
 + 
  
 ===== git diff ===== ===== git diff =====
Line 10: Line 32:
 $ git diff --check $ git diff --check
 </​code>​ </​code>​
 +
 +based on:
 +
 +<​code>​
 +--check
 +    Warn if changes introduce conflict markers or whitespace errors. What are
 +    considered whitespace errors is controlled by core.whitespace configuration.
 +    By default, trailing whitespaces (including lines that solely consist of
 +    whitespaces) and a space character that is immediately followed by a tab
 +    character inside the initial indent of the line are considered whitespace
 +    errors. Exits with non-zero status if problems are found. Not compatible with
 +    --exit-code.
 +
 +--ws-error-highlight=<​kind>​
 +    Highlight whitespace errors in the context, old or new lines of the diff.
 +    Multiple values are separated by comma, none resets previous values, default
 +    reset the list to new and all is a shorthand for old,​new,​context. When this
 +    option is not given, and the configuration variable diff.wsErrorHighlight is
 +    not set, only whitespace errors in new lines are highlighted. The whitespace
 +    errors are colored whith color.diff.whitespace.
 +</​code>​
 +
 +Other possibilities:​
 +
 +<​code>​
 +--ignore-space-at-eol
 +    Ignore changes in whitespace at EOL.
 +
 +-b, --ignore-space-change
 +    Ignore changes in amount of whitespace. This ignores whitespace at line end, and
 +    considers all other sequences of one or more whitespace characters to be equivalent.
 +
 +-w, --ignore-all-space
 +    Ignore whitespace when comparing lines. This ignores differences even if one line has
 +    whitespace where the other line has none.
 +
 +--ignore-blank-lines
 +    Ignore changes whose lines are all blank.
 +</​code>​
 +
 +===== git merge =====
 +
 +Recursive merge options:
 +
 +<​code>​
 +ignore-space-change,​ ignore-all-space,​ ignore-space-at-eol,​ ignore-cr-at-eol
 +    Treats lines with the indicated type of whitespace change as unchanged for the sake
 +    of a three-way merge. Whitespace changes mixed with other changes to a line are not
 +    ignored. See also git-diff(1) -b, -w, --ignore-space-at-eol,​ and --ignore-cr-at-eol.
 +
 +    ·   If their version only introduces whitespace changes to a line, our version is
 +        used;
 +
 +    ·   If our version introduces whitespace changes but their version includes a
 +        substantial change, their version is used;
 +
 +    ·   ​Otherwise,​ the merge proceeds in the usual way.
 +</​code>​
 +
  
 ===== git rebase ===== ===== git rebase =====
Line 57: Line 138:
     ·   ​error-all is similar to error but shows all errors.     ·   ​error-all is similar to error but shows all errors.
 </​code>​ </​code>​
 +
 +===== git blame =====
 +
 +<​code>​
 +-w
 +    Ignore whitespace when comparing the parent’s version and the child’s to find
 +    where the lines came from.
 +</​code>​
 +
 +===== git stripspace =====
 +
 +<​code>​
 +$ man git-stripspace
 +</​code>​
 +
git_whitespace.1528715201.txt.gz · Last modified: 2018/06/11 11:06 by rpjday