git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git fetch one tag only

From
cheng renquan <crquan@gmail.com>
Date
Jun 7, 2012, 05:17 UTC
Message-ID
<CAH5vBdKPH_-cn=r-zxQKCOi5PB5D6vuSXrZxPeZJ+HYg-K9Yqw@mail.gmail.com>
In-Reply-To
<CAPc5daVwOuP_dPiHh5zcjV6kTvdb2FNhzXz_capEDhHgE5ZUKw@mail.gmail.com>
On Wed, Jun 6, 2012 at 9:37 PM, Junio C Hamano <gitster-vger@pobox.com> wrote:
Show 30 quoted lines
> On Wed, Jun 6, 2012 at 6:40 PM, cheng renquan <crquan@gmail.com> wrote:
>>
>> Someone maybe like me is working in the way of following one central
>> git repository
>> while sometimes need to fetch some code or tags from a 3rd git repo,
>> but unfortunately the 3rd repo may contain a lot of tags not all I want
>> to fetch to mess up my local repo, at this time I want to fetch only one tag
>> from the 3rd repo, but the syntax of
>>  `git fetch 3rd-repo the-tag-name`
>>
>> really fetched the code of the-tag-name from 3rd-repo, but forgot the
>> tag itself;
>
>
> The subject of "forgot" in that sentence is you, not "git fetch".
> You told "git fetch" to grab it but not store it locally in your
> refs/tags namespace.
>
> There is a convenience short-hand "tag <tagname>", i.e.
>
>   git fetch 3rd-repo tag the-tag-name
>
> that is equivalent to
>
>   git fetch 3rd-repo refs/tags/the-tag-name:refs/tags/the-tag-name
>
> So I do not think your patch is necessary for your use case, and
> obviously it will
> break other people's use case where they just want to fetch (and inspect what is
> left in FETCH_HEAD) but do not want to store.
No, I tried what you said but it doesn't work as expected:
  git fetch linux-stable tag v3.4.1

My [linus-git] is following torvalds' tree and now I want to fetch just one tag v3.4.1 from linux-stable tree, but the above command would fetch all tags from linux-stable

linus-git git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git (fetch) linux-stable git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git (fetch)

[linus-git] $ git fetch -v --dry-run linux-stable tag v3.4.1 |& head
From git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable
 = [up to date]      v3.4.1     -> v3.4.1
 * [new tag]         latest     -> latest
 * [new tag]         v2.6.12.1  -> v2.6.12.1
 * [new tag]         v2.6.12.2  -> v2.6.12.2
[...]
I didn't know this syntax before, but Yes, this syntax should serve
the one-tag-only goal better,
  `git fetch 3rd-repo tag the-tag-name`
maybe I'd better to fix that?
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 9 in “git fetch one tag only”
  1. git fetch one tag onlycheng renquan, Jun 7, 2012
  2. Junio C HamanoJun 7, 2012
  3. cheng renquanJun 7, 2012
  4. Junio C HamanoJun 7, 2012
  5. cheng renquanJun 7, 2012
  6. cheng renquanJun 7, 2012
  7. Junio C HamanoJun 7, 2012
  8. cheng renquanJun 8, 2012
  9. Junio C HamanoJun 8, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.