git diff --quiet
returns exit code as documented.
git log --qui开发者_开发技巧et
behaves exactly as without quiet.
Did I miss something from the docs:
--quiet
Disable all output of the program. Implies --exit-code.
git 1.6.0
This is supposed to be used in a script to compare mybranch with origin/mybranch, to know should I push it or not.
git rev-list -1 origin/master..master | wc -l
from the link suggested in the comments seems to be the best answer here
精彩评论