Better Git: git fetch not getting tags

I just ran into a little gotcha with regard how fetch handles tags. When it pulls down commits, you will usually see that it also pulls down tags. I was a little confused today when fetch was refusing to pull a tag that was clearly in the repository (“git ls-remote --tags“) lets you see tags available on the remote).

I kept running the fetch command but the tag wouldn’t get pulled down. The reason has to do with the way fetch works, it only fetches tags that are direct references to a commit that is in a branch being fetched. To get all tags regardless of what commits they reference use the fetch in the following way.

From the git manual (“git help fetch”):

-t, –tags Most of the tags are fetched automatically as branch heads are downloaded, but tags that do not point at objects reachable from the branch heads that are being tracked will not be fetched by this mechanism. This flag lets all tags and their associated objects be downloaded. The default behavior for a remote may be specified with the remote.<name>.tagopt setting. See git-config(1).

This will effectively do the inverse of normal fetch. It will fetch all tags, and bring with is any necessary commits.

Hope this helps some poor confused folks out there a little bit of greif.

About these ads

15 Comments on “Better Git: git fetch not getting tags”

  1. Excellent goods from you, man. I have understand your stuff previous to and you
    are just too fantastic. I actually like what you have acquired here,
    really like what you are saying and the way in which you say it.

    You make it entertaining and you still take care
    of to keep it smart. I can’t wait to read far more
    from you. This is actually a wonderful web site.

  2. In general, it will usually cost over $50000 for a heavy-duty, used
    tow truck. When it comes to accessories like this, the old
    advice “you get what you pay for” applies. Though a frontal collision between two
    vehicles has been identified as perhaps the most serious cause of fatalities in driver-to-driver collisions, in regards to
    the passenger, a side impact collision could be more dangerous.

  3. Hi to every , as I am actually eager of reading this weblog’s
    post tto be updated onn a regular basis. It arries nice stuff.

  4. A variety of cool game titles now are out there foor alll ages,
    with functions that remarkably make fascinating adventures near to
    actuality. The games promote sensible movement scenes thanks too their effectively-designed graphics
    and designs.

  5. It’s really very difficult in this active life to listen news on Television, thus
    I only use inrernet for that purpose, and
    obtain the newest news.

  6. Wow that was strange. I just wrote an incredibly long comment but
    after I clicked submit my comjent didn’t show up.
    Grrrr… well I’m not writing all that over again. Anyways,
    just wwanted to say excellent blog!

  7. No Sick Fish says:

    Yοur style is really unique inn comparison to other ƿeople I have read stff from.
    Thanks for posting when you have the opportսnity, Guess I’ll just booƙ mark this web site.

  8. Definitely believe that that you stated. Your favorite justification seemed to be
    at the internet the simplest thing to bear in mind of. I say to
    you, I certainly get annoyed even as folks think about worries that they just do not
    recognize about. You managed to hit the nail upon the top as well
    as outlined out the whole thing without having side effect , other folks could take a signal.

    Will probably be again to get more. Thank you

  9. Hi there to every body, it’s my first pay a quick visit
    of this web site; this blog includes amazing and really fine information designed for
    visitors.

  10. It’s a shame you don’t have a donate button! I’d certainly
    donate to this excellent blog! I guess for now i’ll
    settle for book-marking and adding your RSS feed to my Google account.
    I look forward to brand new updates and will share this site with my Facebook group.
    Talk soon!

  11. ache says:

    WOW just wha ӏ was searching for. Camе here by searching
    forr service chɑrge

  12. Greetings! I know this is kinda ooff topic nevertheless I’d figured
    I’d ask. Would yoou bbe interested in exchanging links oor maybe guest writing a blog article or vice-versa?

    My site addresses a llot of the same topics as yours annd I think we could greatly benefit from each other.
    If you might be interested feel free to sesnd me an email.
    I look forward to hearing freom you! Awesome blog by the
    way!

  13. Clay says:

    ” “What’s the best escape from a kumara. The
    Legends Community is the transcendent instrument for all web ad.
    While these sort of applications help lower tier
    players improve, they can really complicate higher level of play where every inch
    turns into a mile.

  14. babysitter says:

    Asking questions are in fact pleasant thing if you are not understanding anything totally, except
    this piece of writing presents good understanding yet.

  15. visitor says:

    Thanks , I’ve recently been looking for info about this topic
    for ages and yours is the best I’ve came upon till now. However, what
    about the conclusion? Are you sure in regards to the source?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 254 other followers