Re: git: how to figure out with a script what the last commit on remote repo is without fetching it
Jonathan Dowland <jmtd@debian.org> writes:
> On Tue, Sep 09, 2014 at 10:05:33PM +0200, lee wrote:
>> I'm receiving 226542 bytes in 355 lines when I do this for one of the
>> repos ... and same for another one:
>>
>> curl https://github.com/lee-/info/git-newer/refs?service=git-upload-pack | wc -cl
>
> I suspect the right URL should be http://github.com/lee-/git-newer.git/info/refs?service=git-upload-pack
Might be, you script works with it :)
>> So the script would have to remember what the hash was when the remote
>> repo was checked the last time.
>
> Even if your local branches have moved on from the origin's, your git checkout
> knows the sha1 hashes of the remote repo at the time it last fetched. They're
> in .git/refs or possibly .git/packed-refs, and either way there is (or should
> be) a git sub-command to resolve remotes/origin/master into a sha1, but I can't
> recall what it is.
Well, I don't want to program some sort of meta-git ... I merely want a
simple way to be informed about new commits.
--
Knowledge is volatile and fluid. Software is power.
Reply to: