简体   繁体   English

什么是git log pretty格式的占位符,它将显示与--source选项相同的内容?

[英]What is the git log pretty format placeholder that will show the same as the --source option?

I can use the --source option to show me one of the branches that each git commit listed is on, for example 我可以使用--source选项向我显示列出的每个git commit所在的分支之一。

git log --branches --author=Tim --since='February' --decorate --oneline --source

shows me all my commits since February and one of the branches that the commit can be reached from. 向我显示了自2月以来的所有提交以及可以从中访问该提交的分支之一。 Here's how the output looks for me 这是输出对我的外观

git bash屏幕截图

I'd like to add in the date do I have swapped to using the --pretty option: 我想添加使用--pretty选项交换到的日期:

git log --branches --author=Tim --since=February --pretty=format:"%C(yellow)%h%Creset %Cred%d%Creset %C(cyan)%ar%Creset : %s"

and the corresponding output 和相应的输出

git bash屏幕截图

The pretty format placeholder %d adds the "ref names, like the --decorate option" (from the documentation here ). 漂亮的格式占位符%d添加了“引用名称,例如--decorate选项”(来自此处的文档)。 What is the pretty format placeholder to include the ref name by which each commit was reached, like the --source option? 漂亮的格式占位符包括到达每个提交所依据的引用名称,例如--source选项?

What is the pretty format placeholder to include the ref name by which each commit was reached, like the --source option? 漂亮的格式占位符包括到达每个提交所依据的引用名称,例如--source选项?

There isn't one. 没有一个。 The --source option sets a flag that makes the revision walk add the appropriate command-line reference name to each commit the first time the commit is reached . --source选项设置一个标志, 使修订遍历在第一次到达提交时将适当的命令行引用名称添加到每个提交 The same flag is tested, and the saved information shown directly to a stdio stream, in show_decorations in log-tree.c , but nothing in pretty.c uses that field. 同样的标志进行测试,并直接显示到stdio流保存的信息,在show_decorationslog-tree.c中,但没有pretty.c使用该领域。

(Other code uses ->util but for other purposes, hence the field name, util . Note that it should be fairly easy to add a new format character that expands to the util field if saved, but you'd still have to set the flag.) (其他代码使用->util但出于其他目的,因此使用字段名称util 。请注意,添加一个新格式字符(如果保存后会扩展到util字段)应该相当容易,但是您仍然必须设置旗。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM