hi.
I have troubles (probably due to my misunderstanding) with git remote
tracking branches. It seems to me that reality and documentation are
different:
- i clone the linux git repo:
$ git clone
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
linux-2.6.git
- then i add a remote tracking branch:
$ git remote add --tags drm-intel
git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel.git
- Then i do git fetch or git fetch drm-intel, but nothing happens, and
git branch -r still only show me origin/HEAD and origin/master, no
drm-intel branches, though these branches do exist since i can see them
with git remote -v show drm-intel
what am i doing wrong here, any idea?
cheers,
--
Matthieu
On Sun, Feb 13, 2011 at 08:42, Matthieu Imbert [off-list ref] wrote:
$ git clone
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
linux-2.6.git
- then i add a remote tracking branch:
$ git remote add --tags drm-intel
git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel.git
You're adding a remote repository and tracking branches and tags from
it.
- Then i do git fetch or git fetch drm-intel, but nothing happens, and git
branch -r still only show me origin/HEAD and origin/master, no drm-intel
branches, though these branches do exist since i can see them with git
remote -v show drm-intel
You didn't add any remote tracking *branch*, you added a remote and
gave it the name "drm-intel". You could just as well do:
git remote add --tags some-random-name
git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel.git
Also because you specified --tags you're only getting the tags on "git
fetch", if you don't do that then:
$ git fetch some-random-name
remote: Counting objects: 567, done.
remote: Compressing objects: 100% (377/377), done.
remote: Total 488 (delta 371), reused 146 (delta 111)
Receiving objects: 100% (488/488), 91.42 KiB, done.
Resolving deltas: 100% (371/371), completed with 53 local objects.
From git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel
* [new branch] drm-intel-fixes -> some-random-name/drm-intel-fixes
* [new branch] drm-intel-fixes-2 -> some-random-name/drm-intel-fixes-2
* [new branch] drm-intel-next -> some-random-name/drm-intel-next
* [new branch] drm-intel-staging -> some-random-name/drm-intel-staging
Which allows you to do:
$ git checkout --track some-random-name/drm-intel-fixes
Branch drm-intel-fixes set up to track remote branch
drm-intel-fixes from some-random-name.
Switched to a new branch 'drm-intel-fixes'
On 02/13/2011 10:17 AM, Ævar Arnfjörð Bjarmason wrote:
On Sun, Feb 13, 2011 at 08:42, Matthieu Imbert[off-list ref] wrote:
quoted
$ git clone
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
linux-2.6.git
- then i add a remote tracking branch:
$ git remote add --tags drm-intel
git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel.git
You're adding a remote repository and tracking branches and tags from
it.
quoted
- Then i do git fetch or git fetch drm-intel, but nothing happens, and git
branch -r still only show me origin/HEAD and origin/master, no drm-intel
branches, though these branches do exist since i can see them with git
remote -v show drm-intel
You didn't add any remote tracking *branch*, you added a remote and
gave it the name "drm-intel". You could just as well do:
git remote add --tags some-random-name
git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel.git
Also because you specified --tags you're only getting the tags on "git
fetch", if you don't do that then:
$ git fetch some-random-name
remote: Counting objects: 567, done.
remote: Compressing objects: 100% (377/377), done.
remote: Total 488 (delta 371), reused 146 (delta 111)
Receiving objects: 100% (488/488), 91.42 KiB, done.
Resolving deltas: 100% (371/371), completed with 53 local objects.
From git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel
* [new branch] drm-intel-fixes -> some-random-name/drm-intel-fixes
* [new branch] drm-intel-fixes-2 -> some-random-name/drm-intel-fixes-2
* [new branch] drm-intel-next -> some-random-name/drm-intel-next
* [new branch] drm-intel-staging -> some-random-name/drm-intel-staging
Which allows you to do:
$ git checkout --track some-random-name/drm-intel-fixes
Branch drm-intel-fixes set up to track remote branch
drm-intel-fixes from some-random-name.
Switched to a new branch 'drm-intel-fixes'
You're right, the faulty option was --tags. Trying without this i was
able to fetch.
Thanks,
--
Matthieu
On 2011.02.13 10:17:48 +0100, Ævar Arnfjörð Bjarmason wrote:
Also because you specified --tags you're only getting the tags on "git
fetch"
That looks like a bug to me.
It's ok for fetch to treat --tags like a refspec and to have it override
the defaults from the config when the user manually specifies it on the
command line. But when it is part of the default configuration it should
add to remote.<name>.fetch, not override it.
IOW with this configuration:
remote.foo.url = git://host/repo.git
remote.foo.fetch = +refs/heads/*:refs/remotes/foo/*
remote.foo.tagopt = --tags
"git fetch foo" acts like:
git fetch --tags git://host/repo.git
instead of
git fetch --tags git://host/repo.git +refs/heads/*:refs/remotes/foo/*
And I'd argue that the latter makes a lot more sense. Also because the
former could always be achieved by dropping the remote.foo.fetch config
setting.
Thoughts?
Björn