Re: how to check remote git repo for updates without pull/fetch
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Dec 19, 2008, 16:33 UTC
- Message-ID
- <20081219163300.GT32487@spearce.org>
- In-Reply-To
- <494BC89F.9070107@gmail.com>
Ivan Zorin <ivan.a.zorin@gmail.com> wrote:
Show 7 quoted lines
> Hello. I have not very hard question, but I don't know how to better do > it - could you tell me, please, does exist some way to check remote git > repository for updates without downloading any essential files? I > suppose, that such command should just type something like: "already > updated", if current working tree identical to remote repo, and > something like "there is some updates in remote repo", if remote repo > has some new commits and/or branches. Thanks.
There aren't any commands to do it.
What you could do is write a script based upon git ls-remote. A really simple one might be:
#!/bin/sh remote=$1 o=.git/remote_cache.$remote n=$o.new$$ git ls-remote $remote >$n if [ -f $o ] then if diff $o $n >/dev/null then echo "No changes" else mv $n $o echo "Updates available" else mv $n $o echo "New remote remembered..." fi
A much more complex one would actually rewrite refs/heads/ to the correct refs/remotes/ namespace on your local repository and compare the remote ref values to the local refs/remotes values.
Patches for git fetch --pretend or something might be interesting. Though I recall a thread about this before on the MLand saying there was no point. Its not like you can see how big the download would be until after its over.
-- Shawn.