@@ -466,11 +466,41 @@ information.
466466endif::git-format-patch[]
467467
468468-O<orderfile>::
469- Output the patch in the order specified in the
470- <orderfile>, which has one shell glob pattern per line.
469+ Control the order in which files appear in the output.
471470 This overrides the `diff.orderFile` configuration variable
472471 (see linkgit:git-config[1]). To cancel `diff.orderFile`,
473472 use `-O/dev/null`.
473+ +
474+ The output order is determined by the order of glob patterns in
475+ <orderfile>.
476+ All files with pathnames that match the first pattern are output
477+ first, all files with pathnames that match the second pattern (but not
478+ the first) are output next, and so on.
479+ All files with pathnames that do not match any pattern are output
480+ last, as if there was an implicit match-all pattern at the end of the
481+ file.
482+ If multiple pathnames have the same rank (they match the same pattern
483+ but no earlier patterns), their output order relative to each other is
484+ the normal order.
485+ +
486+ <orderfile> is parsed as follows:
487+ +
488+ --
489+ - Blank lines are ignored, so they can be used as separators for
490+ readability.
491+
492+ - Lines starting with a hash ("`#`") are ignored, so they can be used
493+ for comments. Add a backslash ("`\`") to the beginning of the
494+ pattern if it starts with a hash.
495+
496+ - Each other line contains a single pattern.
497+ --
498+ +
499+ Patterns have the same syntax and semantics as patterns used for
500+ fnmantch(3) without the FNM_PATHNAME flag, except a pathname also
501+ matches a pattern if removing any number of the final pathname
502+ components matches the pattern. For example, the pattern "`foo*bar`"
503+ matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`".
474504
475505ifndef::git-format-patch[]
476506-R::
0 commit comments