Re: How to check repository/working tree status from a script

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

 



On Thu, May 21, 2009 at 03:24:57PM +0200, Marc Haber wrote:

> I am now looking for a solution for (b). I tried 
> 
> git log -n1 --pretty=oneline master..origin/master
> 
> but that seems to always give empty output even if a later issued git
> pull will actually pull in changes.

Try running "git fetch" beforehand, which will actually update
origin/master with what is on the remote.

Also, if you are just checking to see whether there is any output, you
can use the plumbing "git rev-list" instead of "git log". So something
like:

  git fetch origin || { echo >&2 unable to fetch; exit 1; }
  test -z "`git rev-list -1 master..origin/master`"

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