diff options
Diffstat (limited to 'devdocs/git/git-name-rev.html')
| -rw-r--r-- | devdocs/git/git-name-rev.html | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/devdocs/git/git-name-rev.html b/devdocs/git/git-name-rev.html new file mode 100644 index 00000000..3e8799c1 --- /dev/null +++ b/devdocs/git/git-name-rev.html @@ -0,0 +1,24 @@ +<h1>git-name-rev</h1> <h2 id="_name">Name</h2> <div class="sectionbody"> <p>git-name-rev - Find symbolic names for given revs</p> </div> <h2 id="_synopsis">Synopsis</h2> <div class="sectionbody"> <div class="verseblock"> <pre class="content" data-language="shell">git name-rev [--tags] [--refs=<pattern>] + ( --all | --annotate-stdin | <commit-ish>… )</pre> </div> </div> <h2 id="_description">Description</h2> <div class="sectionbody"> <p>Finds symbolic names suitable for human digestion for revisions given in any format parsable by <code>git rev-parse</code>.</p> </div> <h2 id="_options">Options</h2> <div class="sectionbody"> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-name-rev.txt---tags"> --tags </dt> <dd> <p>Do not use branch names, but only tags to name the commits</p> </dd> <dt class="hdlist1" id="Documentation/git-name-rev.txt---refsltpatterngt"> --refs=<pattern> </dt> <dd> <p>Only use refs whose names match a given shell pattern. The pattern can be a branch name, a tag name, or a fully qualified ref name. If given multiple times, use refs whose names match any of the given shell patterns. Use <code>--no-refs</code> to clear any previous ref patterns given.</p> </dd> <dt class="hdlist1" id="Documentation/git-name-rev.txt---excludeltpatterngt"> --exclude=<pattern> </dt> <dd> <p>Do not use any ref whose name matches a given shell pattern. The pattern can be one of branch name, tag name or fully qualified ref name. If given multiple times, a ref will be excluded when it matches any of the given patterns. When used together with --refs, a ref will be used as a match only when it matches at least one --refs pattern and does not match any --exclude patterns. Use <code>--no-exclude</code> to clear the list of exclude patterns.</p> </dd> <dt class="hdlist1" id="Documentation/git-name-rev.txt---all"> --all </dt> <dd> <p>List all commits reachable from all refs</p> </dd> <dt class="hdlist1" id="Documentation/git-name-rev.txt---annotate-stdin"> --annotate-stdin </dt> <dd> <p>Transform stdin by substituting all the 40-character SHA-1 hexes (say $hex) with "$hex ($rev_name)". When used with --name-only, substitute with "$rev_name", omitting $hex altogether. This option was called <code>--stdin</code> in older versions of Git.</p> <p>For example:</p> <div class="listingblock"> <div class="content"> <pre data-language="shell-session">$ cat sample.txt + +An abbreviated revision 2ae0a9cb82 will not be substituted. +The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907, +while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad + +$ git name-rev --annotate-stdin <sample.txt + +An abbreviated revision 2ae0a9cb82 will not be substituted. +The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907 (master), +while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad + +$ git name-rev --name-only --annotate-stdin <sample.txt + +An abbreviated revision 2ae0a9cb82 will not be substituted. +The full name after substitution is master, +while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad</pre> </div> </div> </dd> <dt class="hdlist1" id="Documentation/git-name-rev.txt---name-only"> --name-only </dt> <dd> <p>Instead of printing both the SHA-1 and the name, print only the name. If given with --tags the usual tag prefix of "tags/" is also omitted from the name, matching the output of <code>git-describe</code> more closely.</p> </dd> <dt class="hdlist1" id="Documentation/git-name-rev.txt---no-undefined"> --no-undefined </dt> <dd> <p>Die with error code != 0 when a reference is undefined, instead of printing <code>undefined</code>.</p> </dd> <dt class="hdlist1" id="Documentation/git-name-rev.txt---always"> --always </dt> <dd> <p>Show uniquely abbreviated commit object as fallback.</p> </dd> </dl> </div> </div> <h2 id="_examples">Examples</h2> <div class="sectionbody"> <p>Given a commit, find out where it is relative to the local refs. Say somebody wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a. Of course, you look into the commit, but that only tells you what happened, but not the context.</p> <p>Enter <code>git name-rev</code>:</p> <div class="listingblock"> <div class="content"> <pre>% git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a +33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940</pre> </div> </div> <p>Now you are wiser, because you know that it happened 940 revisions before v0.99.</p> <p>Another nice thing you can do is:</p> <div class="listingblock"> <div class="content"> <pre>% git log | git name-rev --annotate-stdin</pre> </div> </div> </div><div class="_attribution"> + <p class="_attribution-p"> + © 2012–2024 Scott Chacon and others<br>Licensed under the MIT License.<br> + <a href="https://git-scm.com/docs/git-name-rev" class="_attribution-link">https://git-scm.com/docs/git-name-rev</a> + </p> +</div> |
