我一直在摆弄git
一些的别名log
命令。我已经拥有了大部分我想要的东西(信用在这里 https://stackoverflow.com/a/9074343/241211),但我在一件事情上遇到了麻烦。当我打电话时...
git log --graph --format=format:'%h - [%ar] %s%+d'
…I get…
* ab123f - [6 hours ago] Fix the references
| (HEAD, origin/master, master)
* bc123f - [8 hours ago] New build syntax
* cd123f - [10 hours ago] Initial import
…where %+d
添加一个新行并将--decorate
其上的标签(如果存在)。我宁愿让标签与时间戳相反,像这样:
* ab123f - [6 hours ago] Fix the references
| (HEAD, origin/master, master)
* bc123f - [8 hours ago] New build syntax
* cd123f - [10 hours ago] Initial import
我该如何实现这个目标?如果没有的话我不想要额外的换行符--decorate
标签。我一直在尝试各种格式占位符: https://git-scm.com/docs/pretty-formats %+d
, %-d
, %+ d
(这不起作用);的排列%>(<N>)
, %>>(<N>)
;等等,但我无法让它做我想做的事。
为了简单起见,颜色和进一步的提交信息已被删除,但它们似乎会干扰托雷克的回答 https://stackoverflow.com/a/22416145/241211。完整命令如下:
git log --graph --format=format:'%C(bold yellow)%h%C(reset) - %C(green)(%ar)%C(reset) %s %C(white)<%an>%C(reset)%C(auto)%+d%C(reset)'