如何让git log不提示继续? [英] How to make git log not prompt to continue?
问题描述
我有几个属于一起的git存储库,还有简单的批处理/ bash文件来循环它们。我经常使用log命令循环它们以快速查看它们处于什么状态。除了一件事:除了一个事情:如果提交消息比我的控制台宽(或有多行)的字符数多,git (END)的换行符,我必须按 q 继续(我猜它通过更多或类似的东西管道输出)。
示例:
I have a couple of git repositories that belong together, and simple batch/bash file to loop over them. I often loop over them with a log command to quickly see what state they are in. This works nicely, except for one thing: if the commit message is longer than the number of characters my console is wide (or has multiple lines), git shows the line, then a newline with (END) and I have to press q to continue (I guess it pipes the output through more or something like that). Example:
> gitloop . "git log --decorate=short --pretty=oneline -n1"
18629ae238e9d5832cb3535ec88274173337a501 (HEAD, origin/master, master) short log
625fb891b9b0b8648459b07ace662ae3b7773c7f (HEAD, origin/master, origin/HEAD, master) short log
dc0838118266ba8570ea338c1faddfe8af0387bb (HEAD, origin/work, origin/master, work, master) oops loooooooooooooong log
-(END)
这很不方便,因为我必须按几下 q ,但我只想看看
This is rather inconvenient as I have to press q a couple of time, whereas I'd just like to see all those oneliners in one go.
如何禁用此行为(最好在保持此日志格式的情况下)?
How can I disable this behaviour (preferrably while still keeping this log format)?
$ b
Git has an option to disable the pager:
-pager log --decorate = short --pretty = oneline -n1
git --no-pager log --decorate=short --pretty=oneline -n1
如果您的寻呼机切割线和您希望保留该行为,或者将管道连接到 cut
...
If your pager cuts lines and you want to retain that behaviour, either pipe to cut
...
git --no-pager log --decorate=short --pretty=oneline -n1 | cut -c 1-$COLUMNS
...或设置环境变量 GIT_PAGER
在调用之前:
...or set the environment variable GIT_PAGER
before the invocation:
GIT_PAGER="cut -c 1-${COLUMNS-80}" git --no-pager log --decorate=short --pretty=oneline -n1
这篇关于如何让git log不提示继续?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!