Thread (1 message) 1 message, 1 author, 2016-06-15

Re: git log --quiet bug?

From: Jeff King <hidden>
Date: 2016-06-15 22:52:27

On Tue, Nov 08, 2011 at 02:31:05PM -0800, Prasad Deshpande wrote:
Thanks for your response. I was actually trying to write a script to
determine if a workspace has commits which haven't been pushed to the
repository. 
For this I was using the following in a bash script:

  ..
  git log origin..HEAD --quiet
  if [ $? -ne 0 ]
  then
    echo

    echo "git log shows files committed but not pushed.. ABORTING"
    echo
    echo "************* `pwd` ***************"
    git log origin..HEAD --color --graph --stat
    exit 1
  fi

  What is the recommended way to do this?
Try:

  test -z "$(git rev-list -1 origin..HEAD)" &&
  echo nothing that needs pushing

You can also use --count to get the exact number, but if you just care
whether there is something or nothing, using "-1" lets git stop the
graph traversal immediately.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help