我需要一个plumbing命令来打印一个给定提交的提交消息--不多不少。
h22fl7wq1#
这不是“管道”,但它会做你想要的:
$ git log --format=%B -n 1 <commit>
如果你绝对需要一个“plumbing”命令(不知道为什么需要),你可以使用rev-list:
rev-list
$ git rev-list --format=%B --max-count=1 <commit>
尽管rev-list除了打印提交消息外,还会打印提交sha(在第一行)。
plupiseo2#
git show比git log更像是一个管道命令,并且具有相同的格式选项:
git show
git log
git show -s --format=%B SHA1
zed5wv103#
不是管道,但我在我的.gitconfig中有这些:
lsum = log -n 1 --pretty=format:'%s' lmsg = log -n 1 --pretty=format:'%s%n%n%b'
这是“最后摘要”和“最后留言”。您可以提供一个提交以获取该提交的摘要或消息。(我使用的是1.7.0.5,所以没有%B。)
cxfofazt4#
这将为您提供一个非常紧凑的列表,其中包含任何指定时间的所有消息。
git log --since=1/11/2011 --until=28/11/2011 --no-merges --format=%B > CHANGELOG.TXT
pzfprimi5#
我开始用
git show-branch --no-name <hash>
它似乎比
git show -s --format=%s <hash>
两者给予相同的结果实际上,我写了一个小工具来查看我所有回购的状态。你可以在github上找到它。
j8ag8udp6#
git-rev-list是一个plumbing命令,让你打印提交的消息。像这样使用它。
git-rev-list
git rev-list --max-count=1 --no-commit-header --format=%B <commit>
--max-count=1
--no-commit-header
--format=%B
%s
%n%n
%b
<commit>
sha
HEAD
branch-name
tag-name
branch1...branch2
它比git log或git show快得多。
6yt4nkrj7#
我使用shortlog来实现:
$ git shortlog master.. Username (3): Write something Add something Bump to 1.3.8
mcdcgff08#
在git中单独获取我的Last Commit Messagegit log --format=%B -n 1 $(git log -1 --pretty=format:"%h") | cat -
git log --format=%B -n 1 $(git log -1 --pretty=format:"%h") | cat -
8条答案
按热度按时间h22fl7wq1#
这不是“管道”,但它会做你想要的:
如果你绝对需要一个“plumbing”命令(不知道为什么需要),你可以使用
rev-list
:尽管
rev-list
除了打印提交消息外,还会打印提交sha(在第一行)。plupiseo2#
git show
比git log
更像是一个管道命令,并且具有相同的格式选项:zed5wv103#
不是管道,但我在我的.gitconfig中有这些:
这是“最后摘要”和“最后留言”。您可以提供一个提交以获取该提交的摘要或消息。(我使用的是1.7.0.5,所以没有%B。)
cxfofazt4#
这将为您提供一个非常紧凑的列表,其中包含任何指定时间的所有消息。
pzfprimi5#
我开始用
它似乎比
两者给予相同的结果
实际上,我写了一个小工具来查看我所有回购的状态。你可以在github上找到它。
j8ag8udp6#
使用git-rev-list打印提交消息
git-rev-list
是一个plumbing命令,让你打印提交的消息。像这样使用它。
--max-count=1
:我们只对一个提交感兴趣--no-commit-header
:不显示默认提交头--format=%B
:显示消息(主题%s
+%n%n
+正文%b
)<commit>
:asha
、HEAD
、branch-name
、tag-name
、branch1...branch2
等它比
git log
或git show
快得多。6yt4nkrj7#
我使用shortlog来实现:
mcdcgff08#
在git中单独获取我的Last Commit Message
git log --format=%B -n 1 $(git log -1 --pretty=format:"%h") | cat -