目录搜索
GuidesgitattributesgiteverydaygitglossarygitignoregitmodulesgitrevisionsgittutorialgitworkflowsAdministrationgit archivegit bundlegit cleangit filter-branchgit fsckgit gcgit instawebgit reflogBasic Snapshottinggit addgit commitgit diffgit mvgit resetgit rmgit statusBranching and Merginggit branchgit checkoutgit loggit mergegit mergetoolgit stashgit tagDebugginggit bisectgit blamegit grepEmailgit amgit format-patchgit request-pullgit send-emailExternal Systemsgit fast-importgit svnGetting and Creating Projectsgit clonegit initGitgit annotategit archimportgit bisect-lk2009git check-attrgit check-mailmapgit check-ref-formatgit checkout-indexgit cherrygit citoolgit columngit credentialgit credential-cachegit credential-storegit cvsexportcommitgit cvsimportgit cvsservergit diff-filesgit diff-treegit difftoolgit fast-exportgit fetch-packgit fmt-merge-msggit get-tar-commit-idgit guigit http-backendgit http-fetchgit http-pushgit imap-sendgit index-packgit interpret-trailersgit ls-remotegit ls-treegit mailinfogit mailsplitgit merge-filegit merge-indexgit merge-one-filegit merge-treegit mktaggit mktreegit name-revgit notesgit p4git pack-objectsgit pack-redundantgit pack-refsgit parse-remotegit patch-idgit prunegit prune-packedgit quiltimportgit receive-packgit remote-extgit remote-fdgit remote-testgitgit repackgit replacegit rereregit send-packgit sh-i18ngit sh-setupgit shellgit show-branchgit show-indexgit stripspacegit unpack-filegit unpack-objectsgit upload-archivegit upload-packgit vargit verify-commitgit verify-taggit whatchangedgit worktreeInspection and Comparisongit describegit shortloggit showMiscellaneousapi credentialsapi indexgitcligitcore tutorialgitcredentialsgitcvs migrationgitdiffcoregithooksgitkgitnamespacesgitremote helpersgitrepository layoutgitsubmodulesgittutorial 2gitwebgitweb.confpack formatUser ManualPatchinggit applygit cherry-pickgit rebasegit revertPlumbing Commandsgit cat-filegit check-ignoregit commit-treegit count-objectsgit diff-indexgit for-each-refgit hash-objectgit ls-filesgit merge-basegit read-treegit rev-listgit rev-parsegit show-refgit symbolic-refgit update-indexgit update-refgit verify-packgit write-treeServer Admingit daemongit update-server-infoSetup and Configgitgit configgit helpSharing and Updating Projectsgit fetchgit pullgit pushgit remotegit submodule
文字

名称

git-name-rev  - 查找给定转速的符号名称

概要

git name-rev [--tags] [--refs=<pattern>]               ( --all | --stdin | <commit-ish>… )

描述

查找适用于人类消化的符号名称,以可解析的任何格式给出修订git rev-parse

选项

--tags

不要使用分支名称,而只使用标签来命名提交

--refs=<pattern>

只能使用名称与给定 shell 模式匹配的引用。该模式可以是分支名称,标签名称或完全限定参考名称之一。如果给定多次,请使用名称与任何给定 shell 模式匹配的 ref。使用--no-refs明确给出任何以前的参考模式。

--exclude=<pattern>

不要使用任何名字与给定 shell 模式匹配的 ref。该模式可以是分支名称,标签名称或完全限定参考名称之一。如果给定多次,当匹配任何给定模式时, ref 将被排除。当和--refs 一起使用时,只有在匹配至少一个--refs 模式并且不匹配任何--exclude 模式时,ref 才会用作匹配。使用--no-exclude明确排除模式的列表。

--all

列出所有提交可达的所有提交

--stdin

通过用“$ hex($ rev_name)”替换所有40个字符的 SHA-1格式(例如$ hex)来转换 stdin。与--name-only 一起使用时,替换为“$ rev_name”,完全省略$ hex。旨在供剧本使用。

--name-only

而不是打印 SHA-1和名称,只打印名称。如果使用--tags 给定,“tags /”的常用标记前缀也将从名称中省略,从而使输出git-describe更加紧密。

--no-undefined

如果参考值未定义,则代码为错误代码!= 0,而不是打印undefined

--always

显示唯一缩写的提交对象作为后备。

示例

给定一个提交,找出它相对于本地裁判的位置。说有人写了你关于那个奇妙的提交 33db5f4d9027a10e477ccf054b2c1ab94f74c85a。当然,你看看提交,但只是告诉你发生了什么,但不是上下文。

输入git name-rev

% git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940

现在你明智了,因为你知道它在 v0.99之前发生了940次修订。

你可以做的另一件好事是:

% git log | git name-rev --stdin
上一篇:下一篇: