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

8 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

Leave a Reply

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

You are commenting using your 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


Get every new post delivered to your Inbox.

Join 254 other followers