GIT-NAME-REV(1)
π GIT-NAME-REV(1) π
okay bestie, so this is git-name-rev from the Git Manual β yes, the actual official one, section 1, we're in the big leagues now β¨
πΈ NAME πΈ
git-name-rev β find symbolic names for given revs π
π¦ SYNOPSIS π¦
git name-rev [--tags] [--refs=<pattern>]
( --all | --annotate-stdin | <commit-ish>... )
like, that's the whole shape of it. noted. memorized. moving on π
β¨ DESCRIPTION β¨
so what does it do? It finds symbolic names that are suitable for human digestion π β for revisions given in any format parsable by git rev-parse. Basically it takes your scary hex soup and turns it into something a person can actually read. it's giving translator. it's giving "let me explain him to you". π«Ά
π OPTIONS π
--tagsβ do not use branch names, bestie. only tags to name the commits. tags only. periodt π--refs=<pattern>β 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. and use--no-refsto clear any previous ref patterns you gave. π§Ή--exclude=<pattern>β 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--refspattern and does not match any--excludepatterns. use--no-excludeto clear the list of exclude patterns. so it's like a lil bouncer for your refs, iykyk πͺ--allβ list all commits reachable from all refs. all of them. every last one. π--annotate-stdinβ 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$hexaltogether. lowkey important: this option was called--stdinin older versions of Git. π
for example:
$ 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
look at that. the full hex ate and left the abbreviated one behind, no crumbs π
--name-onlyβ instead of printing both the SHA-1 and the name, print only the name. if given with--tagsthe usual tag prefix of"tags/"is also omitted from the name, matching the output ofgit-describemore closely. iconic behavior honestly π--no-undefinedβ die with error code!= 0when a reference is undefined, instead of printingundefined. so like, it refuses to be vague. it will not say "idk" it will simply explode. π--alwaysβ show uniquely abbreviated commit object as fallback. a lil safety net for when nothing else is naming it. π«Ά
π EXAMPLES π
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, not the context. rude of it, honestly.
enter git name-rev:
% git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940
now you are wiser π« because you know that it happened 940 revisions before v0.99. the context has been served. slay.
another nice thing you can do is:
% git log | git name-rev --annotate-stdin
literally just pipe your log into it and watch the vibes get labeled. obsessed. π₯
π GIT π
part of the git(1) suite. one of the family. the nepo baby of the git suite, but like, in a talented way. π§
and that's the whole page, bestie! okay so the official footer energy is: Git 2.56.0, dated 2026-09-27 β that's the source/version-and-date sign-off, mwah, go name some revs πβ¨
π¦ where this page comes from
- arch rolling: git 2.56.0-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms