[prev in list] [next in list] [prev in thread] [next in thread]
List: git
Subject: Re: [git] how to check remote git repo for updates without pull/fetch
From: "Boyd Stephen Smith Jr." <bss () iguanasuicide ! net>
Date: 2008-12-21 0:02:53
Message-ID: 200812201802.57953.bss () iguanasuicide ! net
[Download RAW message or body]
On Saturday 2008 December 20 17:41:13 David Aguilar wrote:
> 2008/12/20 James Cloos <cloos@jhcloos.com>:
> > #!/bin/bash
> > #
> > # does this git repo need a pull?
> > #
> > l=$(git log|head -1|awk '{print $NF}')
> > r=$(git ls-remote origin heads/master|awk '{print $1}')
> > test "${r}" != "${l}"
> >
> >
> > -JimC
> > --
> > James Cloos <cloos@jhcloos.com> OpenPGP: 1024D/ED7DAEA6
>
> Hello
>
> Your script will report false positives if you run that in a branch
> where you've made local commits since git log's output will list a
> commit that's not on the remote side.
Change the last line to:
test "${r}" != "$(git merge-base "${r}" "${l}")" and those false positives
should go away.
The script is far from a complete solution to the OPs problem though. It only
checks one, specific remote branch. It only checks against the current
branch. It is the core of something that might be useful as another
subcommand to 'git remote' though.
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss@iguanasuicide.net ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/ \_/
["signature.asc" (application/pgp-signature)]
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic