$ cat .git/remotes/origin
URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Pull: +refs/heads/master:refs/heads/linus_master
$ cat .git/remotes/jejb-scsi-misc-2.6
URL: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
Pull: +refs/heads/master:refs/heads/jejb-scsi-misc-2.6
$ git fetch -f origin jejb-scsi-misc-2.6
error: no such remote ref refs/heads/jejb-scsi-misc-2.6
Fetch failure:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Looks I must give remotes one by one?
--
Dear diary, on Tue, Oct 31, 2006 at 05:32:06PM CET, I got a letter
where Linus Torvalds [off-list ref] said that...
On Tue, 31 Oct 2006, Michael S. Tsirkin wrote:
quoted
$ cat .git/remotes/origin
URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Pull: +refs/heads/master:refs/heads/linus_master
$ cat .git/remotes/jejb-scsi-misc-2.6
URL: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
Pull: +refs/heads/master:refs/heads/jejb-scsi-misc-2.6
$ git fetch -f origin jejb-scsi-misc-2.6
error: no such remote ref refs/heads/jejb-scsi-misc-2.6
Fetch failure:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Looks I must give remotes one by one?
Yes. A single "fetch" will only ever connect to a single repository. If
you want to fetch from multiple repositories, you have to do multiple
connections, and thus multiple "fetch"es.
Note that I made a (hackish) patch for fetching from multiple
repositories in one connection (look for "Allow fetching from multiple
repositories at once"). It's currently in limbo since IIRC Junio wanted
some benchmarks, I don't have time to do them and the group I did this
for (the xorg people) has shown zero interest in testing the patch
either.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
On Tue, 31 Oct 2006, Michael S. Tsirkin wrote:
$ cat .git/remotes/origin
URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Pull: +refs/heads/master:refs/heads/linus_master
$ cat .git/remotes/jejb-scsi-misc-2.6
URL: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
Pull: +refs/heads/master:refs/heads/jejb-scsi-misc-2.6
$ git fetch -f origin jejb-scsi-misc-2.6
error: no such remote ref refs/heads/jejb-scsi-misc-2.6
Fetch failure:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Looks I must give remotes one by one?
Yes. A single "fetch" will only ever connect to a single repository. If
you want to fetch from multiple repositories, you have to do multiple
connections, and thus multiple "fetch"es.
The protocol doesn't even really allow for connecting to two different
repositories with one connection.
There's also a purely syntactic issue: when you say
git fetch -f origin jejb-scsi-misc-2.6
then the "origin" is considered to specify the repository (and any
"default branches") and any subsequent arguments are considered to
override the _branch_ information in that repository. So the above command
literally means "fetch branch 'jejb-scsi-misc-2.6' from the repository
described by 'origin'".
Btw, this _syntactic_ issue is separate from the issue of actually
initiating multiple connections. For example, "git push" actually
understands that you can push multiple different repositories at once, but
even then you can't specify it on the command line directly, for the exact
same reason as the above "git fetch" thing: the first argument is
considered the "repository" specifier, and any subsequent arguments are
specifiers for which branches/tags to push.
So for "git push" (where it makes sense to push the same branches multiple
times), you can actually do what I do:
- .git/config contains:
[remote "all"]
url = master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
url = login.osdl.org:linux-2.6.git
- and not "git push all master" will push the "master" branch to _both_
of those remote repositories.
However, even that doesn't really make sense for "git fetch": while it is
a sensible operation to push the same branch-specifier to more than one
repository, it does _not_ make sense to _fetch_ the same branch-specifier
from more than one repository.
So multiple fetches would only make sense if you don't allow any branch
specifiers (and then they'd be fetched from whatever branches the
"remotes" file says). But that would make "git fetch" have two totally
different modes, so that's not very good either.
And in the end, even a "git push all" that pushes to multiple repositories
will actually end up connecting once for each repository, so it's really
just a shorthand for doing multiple "git push"es. There's no real
technical advantage, just a convenience.
So I'd suggest just doing
git fetch origin
git fetch jejb-scsi-misc-2.6
separately. Sadly, there's not even any way to fake this out with a git
alias.