Re: git log --quiet bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]