rogerxu / git-tips

Tips for Git
Apache License 2.0
2 stars 3 forks source link

Diff #34

Open rogerxu opened 6 years ago

rogerxu commented 6 years ago

Git - git-diff Documentation

rogerxu commented 6 years ago

Select Files

--diff-filter=[(A|C|D|M|R|T|U|X|B)…​[*]]

The B “broken pair” status never appears directly in --name-status output, it is only useful as an argument to the option --diff-filter when also using the option -B (--break-rewrites). Using it as a filter selects files that have had at least a certain percentage of their content deleted or changed.

This “breaking” is not be terribly useful with --name-status since the point of “breaking” is mostly to change how the diff text is generated: it eliminates context lines (unchanged lines) from the diff output instead of generating the add and remove lines that would be required around whatever “random” common subsequences the diff algorithm happened to find.

Inclusive Filter

Show list of the all conflicted paths.

git diff --name-only --diff-filter=U

Exclusive Filter

The upper-case letters can be downcased to exclude.

Exclude deleted paths.

git diff --name-only --diff-filter=d
rogerxu commented 6 years ago

Staged

Show changes which will be pushed to next commit.

$ git diff --staged