在最新版本的git中,您可以使用标志--分支(或-b)来“以短格式显示分支和跟踪信息”。
什么时候(哪个版本) git引入了这个选项?我知道,至少在1.7.0.4中,这不是一个选项。
发布于 2011-10-27 05:41:29
git grep -F和git log --oneline -S的组合通常是从Git代码库中挖掘任何内容的强大方法:
(manojlds在his answer中提出了一个一行程序,如果您像OP的问题那样搜索正确的注释,它应该在大多数情况下都有效。去投票吧)。
VonC@NETVONC ~/Prog/git/git (master)
$ git grep -F 'Show the branch'
Documentation/git-status.txt: Show the branch and tracking info even in short-format.
VonC@NETVONC ~/Prog/git/git (master)
$ git log --oneline --follow -S'Show the branch' -- Documentation/git-status.txt
46077fa Documentation+t5708: document and test status -s -b
VonC@NETVONC ~/Prog/git/git (master)
$ git tag --contains 46077fa
ko-maint
ko-master
ko-next
ko-pu
v1.7.2So 1.7.2
(我总是发现this thread是一个很好的git挖掘的例子)
注:根据git describe,在1.7.1之后引入了233个提交
VonC@NETVONC ~/Prog/git/git (master)
$ git describe 46077fa
v1.7.1-233-g46077fa首次发布时间:5月25日16:52:03 2010 +0200
VonC@NETVONC ~/Prog/git/git (master)
$ git show 46077fa
commit 46077fa5d477a3e96e0bb96042a2a9fdc9c818cb
Author: Michael J Gruber <git@drmicha.warpmail.net>
Date: Tue May 25 16:52:03 2010 +0200
Documentation+t5708: document and test status -s -b
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>发布于 2011-10-27 11:52:26
我通常会搜索字符串,并在发行说明中查找它们(这样您就可以确切地知道它是用一个命令添加的版本):
类似这样的东西是有效的:
$ git grep -F "shows the current branch"
Documentation/RelNotes/1.7.2.txt: * "git status -s -b" shows the current branch显然,它是在1.7.2中添加的。当然,您必须玩弄这些单词,但您可以使用正则表达式来更容易地查找。
你可以使用github的高级搜索进行类似的搜索,这样你就不需要克隆源代码了。
你可以这样做:
repo:git/git path:Documentation/RelNotes/* <what you want to find>要联机搜索发行说明,请执行以下操作
https://stackoverflow.com/questions/7909146
复制相似问题