排除先前的提交>来自git rev-list格式的行 [英] Exclude Preceding Commit> line from git rev-list formatting
问题描述
我正在尝试使用分支diff命令,并且我已经完成了所有工作......除了格式化之外。我可以使用 - pretty = oneline
来显示我想要的信息,除了它显示完整的散列,并且不会着色输出。
所以它只输出这个:
fa73c05913292fbce940075fc8f454bad5066666示例提交消息
de4dbeffa249393dddebb7b13ae555cb97cad5be另一个示例提交消息
如果我尝试自定义格式字符串,例如如下所示: - pretty =format:%C(yellow)%h%C(reset)%s
,它可以工作,它。
例如
提交> fa73c05913292fbce940075fc8f454bad5066666
fa73c05示例提交消息
commit> de4dbeffa249393dddebb7b13ae555cb97cad5be
de4dbef另一个示例提交消息
输出一个没有前面的 commit> abcdef3 ...
行的格式? git rev-list
/ p>
给下一个会来的人留下一个答案/ $ / b>
@torec在他的评论中提到:
$ b
git rev-list
和git log
实质上是相同的命令
答案是使用以下格式:
#以所需格式打印日志历史记录。
git log --pretty =format:...< SHA-1>
I'm trying to work on a branch diff command, and I've got it all working... Except for the formatting. I can use --pretty=oneline
to display just the information I want, except it displays the full hash, and doesn't colorize the output.
So it'd just output this:
fa73c05913292fbce940075fc8f454bad5066666 Example Commit Message
de4dbeffa249393dddebb7b13ae555cb97cad5be Another Example Commit Message
If I try and do a custom format string, such as this: --pretty="format:%C(yellow)%h%C(reset) %s"
, it works, but it also displays an additional line above it.
E.g.
commit >fa73c05913292fbce940075fc8f454bad5066666
fa73c05 Example Commit Message
commit >de4dbeffa249393dddebb7b13ae555cb97cad5be
de4dbef Another Example Commit Message
Is there a way to have git rev-list
output a format without the preceding commit >abcdef3...
lines?
To leave an answer for those who will come next/
@torec mentioned in his comment the following:
git rev-list
andgit log
are essentially the same command
The answer is to use the following format:
# print out the log history in the desired format.
git log --pretty="format:..." <SHA-1>
这篇关于排除先前的提交>来自git rev-list格式的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!