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

Re: git: how to figure out with a script what the last commit on remote repo is without fetching it



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

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



Reply to: