How to make git log not prompt to continue?

后端 未结 4 1274
梦毁少年i
梦毁少年i 2020-12-08 01:44

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 t

4条回答
  •  有刺的猬
    2020-12-08 02:02

    Git has an option to disable the pager:

    git --no-pager log --decorate=short --pretty=oneline -n1
    

    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
    

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

提交回复
热议问题