How to check new commit availability without full fetch?

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

How to check new commit availability without full fetch?

From: Leo Razoumov <hidden>
Date: 2016-06-15 22:47:59

Hi List,
I am trying to find a way to check availability of new commits
*before* doing fetch or pull. Unfortunately, neither fetch nor pull
take "--dry-run" option (unlike push)
I am sure I am not the only one with such an itch.

Any help and advice are greatly appreciated.

--Leo--

Re: How to check new commit availability without full fetch?

From: Nicolas Pitre <nico@fluxnic.net>
Date: 2016-06-15 22:47:59

On Sun, 10 Jan 2010, Leo Razoumov wrote:
Hi List,
I am trying to find a way to check availability of new commits
*before* doing fetch or pull. Unfortunately, neither fetch nor pull
take "--dry-run" option (unlike push)
But... _Why_ do you want/need to do that?

You could use ls-remote to see what the remote branch is pointing to, 
e.g.:

	git ls-remote origin master

and compare with the local view of that remote branch:

	git show-ref origin/master

And if both SHA1 strings match then there is nothing new to fetch.
I am sure I am not the only one with such an itch.
Maybe you are. There is very little point knowing that the remote repo 
has new commits if you're not going to fetch them, so I don't understand 
why you need this.


Nicolas

Re: How to check new commit availability without full fetch?

From: Robin Rosenberg <hidden>
Date: 2016-06-15 22:47:59

söndagen den 10 januari 2010 12.12.09 skrev  Leo Razoumov:
Hi List,
I am trying to find a way to check availability of new commits
*before* doing fetch or pull. Unfortunately, neither fetch nor pull
take "--dry-run" option (unlike push)
Fetch has --dry-run. It's a fairly new option. The drawback is that it
still does the fetch, but it does not update the refs. If you re.run it
again it'll be quicker.

A faster option is to use ls-remote, but you'll have to parse the data
yourself and compare with your remote refs to see what refs has changed,
and that will not tell you /what/ the changes are.

-- robin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help