在最新版本的git中,您可以使用标志--branch(或-b)来“以短格式显示分支和跟踪信息”。
什么时候(哪个版本)git引入了这个选项?我知道至少在1.7.0.4中它不是一种选择。
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.2
所以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
它于2010年5月25日16:52:03 +0200首次推出
VonC@NETVONC ~/Prog/git/git (master)
$ git show 46077fa
commit 46077fa5d477a3e96e0bb96042a2a9fdc9c818cb
Author: Michael J Gruber <[email protected]>
Date: Tue May 25 16:52:03 2010 +0200
Documentation+t5708: document and test status -s -b
Signed-off-by: Michael J Gruber <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
我通常会在发行说明中搜索字符串并查找它们(这样您只需一个命令就可以确切地知道它添加了哪个版本):
像这样的东西有效:
$ 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>
在线搜索发行说明