summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/git-for-each-ref.txt42
1 files changed, 23 insertions, 19 deletions
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index 8e4d16d7a3..2008600e7e 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -95,13 +95,15 @@ refname::
The name of the ref (the part after $GIT_DIR/).
For a non-ambiguous short name of the ref append `:short`.
The option core.warnAmbiguousRefs is used to select the strict
- abbreviation mode. If `lstrip=<N>` is appended, strips `<N>`
- slash-separated path components from the front of the refname
- (e.g. `%(refname:lstrip=2)` turns `refs/tags/foo` into `foo`.
+ abbreviation mode. If `lstrip=<N>` (`rstrip=<N>`) is appended, strips `<N>`
+ slash-separated path components from the front (back) of the refname
+ (e.g. `%(refname:lstrip=2)` turns `refs/tags/foo` into `foo` and
+ `%(refname:rstrip=2)` turns `refs/tags/foo` into `refs`).
If `<N>` is a negative number, strip as many path components as
- necessary from the left to leave `-<N>` path components
+ necessary from the specified end to leave `-<N>` path components
(e.g. `%(refname:lstrip=-2)` turns
- `refs/tags/foo` into `tags/foo`). When the ref does not have
+ `refs/tags/foo` into `tags/foo` and `%(refname:rstrip=-1)`
+ turns `refs/tags/foo` into `refs`). When the ref does not have
enough components, the result becomes an empty string if
stripping with positive <N>, or it becomes the full refname if
stripping with negative <N>. Neither is an error.
@@ -121,22 +123,23 @@ objectname::
upstream::
The name of a local ref which can be considered ``upstream''
- from the displayed ref. Respects `:short` and `:lstrip` in the
- same way as `refname` above. Additionally respects `:track`
- to show "[ahead N, behind M]" and `:trackshort` to show the
- terse version: ">" (ahead), "<" (behind), "<>" (ahead and
- behind), or "=" (in sync). `:track` also prints "[gone]"
- whenever unknown upstream ref is encountered. Append
- `:track,nobracket` to show tracking information without
- brackets (i.e "ahead N, behind M"). Has no effect if the ref
- does not have tracking information associated with it. All
- the options apart from `nobracket` are mutually exclusive, but
- if used together the last option is selected.
+ from the displayed ref. Respects `:short`, `:lstrip` and
+ `:rstrip` in the same way as `refname` above. Additionally
+ respects `:track` to show "[ahead N, behind M]" and
+ `:trackshort` to show the terse version: ">" (ahead), "<"
+ (behind), "<>" (ahead and behind), or "=" (in sync). `:track`
+ also prints "[gone]" whenever unknown upstream ref is
+ encountered. Append `:track,nobracket` to show tracking
+ information without brackets (i.e "ahead N, behind M"). Has
+ no effect if the ref does not have tracking information
+ associated with it. All the options apart from `nobracket`
+ are mutually exclusive, but if used together the last option
+ is selected.
push::
The name of a local ref which represents the `@{push}`
location for the displayed ref. Respects `:short`, `:lstrip`,
- `:track`, and `:trackshort` options as `upstream`
+ `:rstrip`, `:track`, and `:trackshort` options as `upstream`
does. Produces an empty string if no `@{push}` ref is
configured.
@@ -178,8 +181,9 @@ if::
symref::
The ref which the given symbolic ref refers to. If not a
- symbolic ref, nothing is printed. Respects the `:short` and
- `:lstrip` options in the same way as `refname` above.
+ symbolic ref, nothing is printed. Respects the `:short`,
+ `:lstrip` and `:rstrip` options in the same way as `refname`
+ above.
In addition to the above, for commit and tag objects, the header
field names (`tree`, `parent`, `object`, `type`, and `tag`) can