Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/git-for-each-ref.adoc # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / git-for-each-ref.adoc` 478 lines ยท 16213 bytes Raw Blame History 1 git-for-each-ref(1) 2 =================== 3 4 NAME 5 ---- 6 git-for-each-ref - Output information on each ref 7 8 SYNOPSIS 9 -------- 10 [synopsis] 11 git for-each-ref [--count=] [--shell|--perl|--python|--tcl] 12 [(--sort=)...] [--format=] 13 [--include-root-refs] [--points-at=] 14 [--merged[=]] [--no-merged[=]] 15 [--contains[=]] [--no-contains[=]] 16 [(--exclude=)...] [--start-after=] 17 [ --stdin | (...)] 18 19 DESCRIPTION 20 ----------- 21 22 Iterate over all refs that match __ and show them 23 according to the given __, after sorting them according 24 to the given set of __. If __ is given, stop after 25 showing that many refs. The interpolated values in __ 26 can optionally be quoted as string literals in the specified 27 host language allowing their direct evaluation in that language. 28 29 OPTIONS 30 ------- 31 include::for-each-ref-options.adoc[] 32 33 FIELD NAMES 34 ----------- 35 36 Various values from structured fields in referenced objects can 37 be used to interpolate into the resulting output, or as sort 38 keys. 39 40 For all objects, the following names can be used: 41 42 `refname`:: 43 The name of the ref (the part after `$GIT_DIR/`). 44 For a non-ambiguous short name of the ref append `:short`. 45 The option `core.warnAmbiguousRefs` is used to select the strict 46 abbreviation mode. If `lstrip=` (`rstrip=`) is appended, strip __ 47 slash-separated path components from the front (back) of the refname 48 (e.g. `%(refname:lstrip=2)` turns `refs/tags/foo` into `foo` and 49 `%(refname:rstrip=2)` turns `refs/tags/foo` into `refs`). 50 If __ is a negative number, strip as many path components as 51 necessary from the specified end to leave `-` path components 52 (e.g. `%(refname:lstrip=-2)` turns 53 `refs/tags/foo` into `tags/foo` and `%(refname:rstrip=-1)` 54 turns `refs/tags/foo` into `refs`). When the ref does not have 55 enough components, the result becomes an empty string if 56 stripping with positive __, or it becomes the full refname if 57 stripping with negative __. Neither is an error. 58 + 59 `strip` can be used as a synonym to `lstrip`. 60 61 `objecttype`:: 62 The type of the object (`blob`, `tree`, `commit`, `tag`). 63 64 `objectsize`:: 65 The size of the object (the same as 'git cat-file -s' reports). 66 Append `:disk` to get the size, in bytes, that the object takes up on 67 disk. See the note about on-disk sizes in the 68 <> section below. 69 `objectname`:: 70 The object name (aka SHA-1). 71 For a non-ambiguous abbreviation of the object name append `:short`. 72 For an abbreviation of the object name with desired length append 73 `:short=`, where the minimum length is `MINIMUM_ABBREV`. The 74 length may be exceeded to ensure unique object names. 75 `deltabase`:: 76 This expands to the object name of the delta base for the 77 given object, if it is stored as a delta. Otherwise it 78 expands to the null object name (all zeroes). 79 80 `upstream`:: 81 The name of a local ref which can be considered ``upstream'' 82 from the displayed ref. Respects `:short`, `:lstrip` and 83 `:rstrip` in the same way as `refname` above. Additionally 84 respects `:track` to show "[ahead N, behind M]" and 85 `:trackshort` to show the terse version: ">" (ahead), "<" 86 (behind), "<>" (ahead and behind), or "=" (in sync). `:track` 87 also prints "[gone]" whenever unknown upstream ref is 88 encountered. Append `:track,nobracket` to show tracking 89 information without brackets (i.e "ahead N, behind M"). 90 + 91 For any remote-tracking branch `%(upstream)`, `%(upstream:remotename)` 92 and `%(upstream:remoteref)` refer to the name of the remote and the 93 name of the tracked remote ref, respectively. In other words, the 94 remote-tracking branch can be updated explicitly and individually by 95 using the refspec `%(upstream:remoteref):%(upstream)` to fetch from 96 `%(upstream:remotename)`. 97 + 98 Has no effect if the ref does not have tracking information associated 99 with it. All the options apart from `nobracket` are mutually exclusive, 100 but if used together the last option is selected. 101 102 `push`:: 103 The name of a local ref which represents the `@{push}` 104 location for the displayed ref. Respects `:short`, `:lstrip`, 105 `:rstrip`, `:track`, `:trackshort`, `:remotename`, and `:remoteref` 106 options as `upstream` does. Produces an empty string if no `@{push}` 107 ref is configured. 108 109 `HEAD`:: 110 `*` if `HEAD` matches current ref (the checked out branch), ' ' 111 otherwise. 112 113 `color`:: 114 Change output color. Followed by `:`, where color 115 names are described under Values in the "CONFIGURATION FILE" 116 section of linkgit:git-config[1]. For example, 117 `%(color:bold red)`. 118 119 `align`:: 120 Left-, middle-, or right-align the content between 121 `%(align:...)` and `%(end)`. The "`align:`" is followed by 122 `width=` and `position=` in any order 123 separated by a comma, where the __ is either `left`, 124 `right` or `middle`, default being `left` and __ is the total 125 length of the content with alignment. For brevity, the 126 "width=" and/or "position=" prefixes may be omitted, and bare 127 __ and __ used instead. For instance, 128 `%(align:,)`. If the contents length is more 129 than the width then no alignment is performed. If used with 130 `--quote` everything in between `%(align:...)` and `%(end)` is 131 quoted, but if nested then only the topmost level performs 132 quoting. 133 134 `if`:: 135 Used as `%(if)...%(then)...%(end)` or 136 `%(if)...%(then)...%(else)...%(end)`. If there is an atom with 137 value or string literal after the `%(if)` then everything after 138 the `%(then)` is printed, else if the `%(else)` atom is used, then 139 everything after %(else) is printed. We ignore space when 140 evaluating the string before `%(then)`, this is useful when we 141 use the `%(HEAD)` atom which prints either "`*`" or " " and we 142 want to apply the 'if' condition only on the `HEAD` ref. 143 Append "`:equals=`" or "`:notequals=`" to compare 144 the value between the `%(if:...)` and `%(then)` atoms with the 145 given string. 146 147 `symref`:: 148 The ref which the given symbolic ref refers to. If not a 149 symbolic ref, nothing is printed. Respects the `:short`, 150 `:lstrip` and `:rstrip` options in the same way as `refname` 151 above. 152 153 `signature`:: 154 The GPG signature of a commit. 155 156 `signature:grade`:: 157 Show 158 `G`;; for a good (valid) signature 159 `B`;; for a bad signature 160 `U`;; for a good signature with unknown validity 161 `X`;; for a good signature that has expired 162 `Y`;; for a good signature made by an expired key 163 `R`;; for a good signature made by a revoked key 164 `E`;; if the signature cannot be checked (e.g. missing key) 165 `N`;; for no signature. 166 167 `signature:signer`:: 168 The signer of the GPG signature of a commit. 169 170 `signature:key`:: 171 The key of the GPG signature of a commit. 172 173 `signature:fingerprint`:: 174 The fingerprint of the GPG signature of a commit. 175 176 `signature:primarykeyfingerprint`:: 177 The primary key fingerprint of the GPG signature of a commit. 178 179 `signature:trustlevel`:: 180 The trust level of the GPG signature of a commit. Possible 181 outputs are `ultimate`, `fully`, `marginal`, `never` and `undefined`. 182 183 `worktreepath`:: 184 The absolute path to the worktree in which the ref is checked 185 out, if it is checked out in any linked worktree. Empty string 186 otherwise. 187 188 `ahead-behind:`:: 189 Two integers, separated by a space, demonstrating the number of 190 commits ahead and behind, respectively, when comparing the output 191 ref to the __ specified in the format. 192 193 `is-base:`:: 194 In at most one row, `()` will appear to indicate the ref 195 that is most likely the ref used as a starting point for the branch 196 that produced __. This choice is made using a heuristic: 197 choose the ref that minimizes the number of commits in the 198 first-parent history of __ and not in the first-parent 199 history of the ref. 200 + 201 For example, consider the following figure of first-parent histories of 202 several refs: 203 + 204 ---- 205 *--*--*--*--*--* refs/heads/A 206 \ 207 \ 208 *--*--*--* refs/heads/B 209 \ \ 210 \ \ 211 * * refs/heads/C 212 \ 213 \ 214 *--* refs/heads/D 215 ---- 216 + 217 Here, if `A`, `B`, and `C` are the filtered references, and the format 218 string is `%(refname):%(is-base:D)`, then the output would be 219 + 220 ---- 221 refs/heads/A: 222 refs/heads/B:(D) 223 refs/heads/C: 224 ---- 225 + 226 This is because the first-parent history of `D` has its earliest 227 intersection with the first-parent histories of the filtered refs at a 228 common first-parent ancestor of `B` and `C` and ties are broken by the 229 earliest ref in the sorted order. 230 + 231 Note that this token will not appear if the first-parent history of 232 __ does not intersect the first-parent histories of the 233 filtered refs. 234 235 `describe[: