简体   繁体   中英

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

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. 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:

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 ). What is the pretty format placeholder to include the ref name by which each commit was reached, like the --source option?

What is the pretty format placeholder to include the ref name by which each commit was reached, like the --source option?

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 . 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.

(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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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