admin管理员组文章数量:1435859
git log --graph --oneline --all
is quite useful. How can I align the formatted logs to start in the same column though?
For example
git log --graph --oneline --all --format='%C(auto)%<|(15)%h %d %s'
got me quite close, thanks to
%<|( <M> )
make the next placeholder take at least until Mth display column, padding spaces on the right if necessary.
But a hardcoded %<|(15)
will not keep working once the graph itself becomes wider than 15 characters!
git log --graph --oneline --all
is quite useful. How can I align the formatted logs to start in the same column though?
For example
git log --graph --oneline --all --format='%C(auto)%<|(15)%h %d %s'
got me quite close, thanks to
%<|( <M> )
make the next placeholder take at least until Mth display column, padding spaces on the right if necessary.
But a hardcoded %<|(15)
will not keep working once the graph itself becomes wider than 15 characters!
1 Answer
Reset to default 3You're going to need to postprocess the output, column alignment is a two-pass algorithm, that kind of pretty is outside git log
's remit.
First cut at it (for portable scripting put #!/bin/bash
up front):
git log --graph --oneline --all --color=always \
| sed 's,.*\x1b\[m ,&\t,' | column -ts$'\t'
which passed my smoketests on a couple histories I've got handy.
本文标签: gitAlign information in a column next to graphStack Overflow
版权声明:本文标题:git - Align information in a column next to graph? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745674149a2669747.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论