[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



"Claes Wallin (韋嘉誠)" <gmane@clacke.user.lysator.liu.se> writes:

> On 06/09/14 06:04, lee wrote:
>> Hi,
>>
>> how would I figure out what the last commit to a remote repo was without
>> first fetching or pulling the remote repo?
>
> $ git ls-remote origin
>
> ... will show you the list of references (tags, branches/heads) that
> exist on the remote "origin", and what SHA1 they are currently referring
> to. This is a live check actually going to the server. Works for git,
> git+ssh, https, whatever protocol you are using.
>
> $ git ls-remote origin refs/heads/master
>
> ... will show you the SHA1 that the master branch on the remote
> currently points to.

Oh, thank you!  That gives me, as first line, something like

cbf7b9e0af314126ea10dc3b358c27a612f62df6        HEAD

which is probably what I'm interested in in the first place.  That's
easy to parse, and when it changes, I can just send an email :)


-- 
Hallowed are the Debians!


Reply to: