path: root/Documentation/diff-options.txt
diff options
authorJunio C Hamano <>2017-01-23 23:59:23 (GMT)
committerJunio C Hamano <>2017-01-23 23:59:23 (GMT)
commit831bd5e775ad5225f2a98eba738f69148cd50e0a (patch)
tree305316a46768a32e9559a734fdbf25295d632705 /Documentation/diff-options.txt
parente11c8261ba70f16b86ec662c027c9be649d9aea4 (diff)
parent874444b70451879d5b9b7e288e5c4e711c4a87ac (diff)
Merge branch 'rh/diff-orderfile-doc'
Documentation fix. * rh/diff-orderfile-doc: diff: document the format of the -O (diff.orderFile) file diff: document behavior of relative diff.orderFile
Diffstat (limited to 'Documentation/diff-options.txt')
1 files changed, 32 insertions, 2 deletions
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index a219aa2..d91ddbd 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -466,11 +466,41 @@ information.
- Output the patch in the order specified in the
- <orderfile>, which has one shell glob pattern per line.
+ Control the order in which files appear in the output.
This overrides the `diff.orderFile` configuration variable
(see linkgit:git-config[1]). To cancel `diff.orderFile`,
use `-O/dev/null`.
+The output order is determined by the order of glob patterns in
+All files with pathnames that match the first pattern are output
+first, all files with pathnames that match the second pattern (but not
+the first) are output next, and so on.
+All files with pathnames that do not match any pattern are output
+last, as if there was an implicit match-all pattern at the end of the
+If multiple pathnames have the same rank (they match the same pattern
+but no earlier patterns), their output order relative to each other is
+the normal order.
+<orderfile> is parsed as follows:
+ - Blank lines are ignored, so they can be used as separators for
+ readability.
+ - Lines starting with a hash ("`#`") are ignored, so they can be used
+ for comments. Add a backslash ("`\`") to the beginning of the
+ pattern if it starts with a hash.
+ - Each other line contains a single pattern.
+Patterns have the same syntax and semantics as patterns used for
+fnmantch(3) without the FNM_PATHNAME flag, except a pathname also
+matches a pattern if removing any number of the final pathname
+components matches the pattern. For example, the pattern "`foo*bar`"
+matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`".