首页 > 解决方案 > How do you override the stat width in git pull?

问题描述

When running git log, you can specify eg --stat=180 to override the width of the stats graph. git pull has a --stat option but it doesn't take a width.

Context: I'm calling git pull over ssh in a cron job. It falls back to a default width of 80, which isn't what I want. There's no tty, so I can't set the width with stty.

标签: git

解决方案


Option --stat takes no value in git pull but you can use a different command like git diff. You need to write down the current head commit, run git pull and then git diff --stat:

prev_commit=`git rev-parse HEAD`
git pull
git diff --stat=180 $prev_commit

推荐阅读