Re: git-fetch remote tag to local branch fails
- From
Michael J Gruber <michaeljgruber+gmane@fastmail.fm>
- Date
- Jun 24, 2008, 14:57 UTC
- Message-ID
- <g3r1vv$7dr$1@ger.gmane.org>
- In-Reply-To
- <33f4f4d70806240701o1c00cef2g688a188970964b0f@mail.gmail.com>
Klas Lindberg venit, vidit, dixit 24.06.2008 16:01:
Show 18 quoted lines
> Hello > >> git tag -l > foo_tag > test_tag > >> git branch -a >> > > At this point, I can create the branch "b" from "foo_tag", so the > fetch did get me a remote tag. It just didn't update a local branch > with the contents (or create a new one). > > Something that also confuses me is that if branch "b" already exists, then > >> git-pull bogustree refs/tags/foo_tag:refs/heads/b > > actually does update branch "b". I find the behaviour quite inconsistent.
You tell git to fetch everything up to the tag you specify, to store those refs into branch b, and then to merge into the current branch. This is what git did (assuming you see the merge in the current branch; if it's b then it has been fast forwarded already).
> Unfortunately it isn't a solution for me to fetch tags and then create > branches from the tags. I need to be able to update existing branches, > and I have to do that without first making such a branch the current > branch.
If I try what you described (using git 1.5.6) in a fresh repo (with one empty commit) I get:
git fetch ../fromrepo refs/tags/testtag:refs/heads/newbranch warning: no common commits remote: Counting objects: 18, done. remote: Compressing objects: 100% (18/18), done. remote: Total 18 (delta 9), reused 0 (delta 0) Unpacking objects: 100% (18/18), done. From ../fromrepo * [new branch] testtag -> newbranch * [new tag] testtag -> testtag
I see a new branch, disconnected from master (no common commits), and a new tag pointing to the head of newbranch. All is well here. Maybe you can set-up a minimal example or share a repo which exposes your problem?
Michael