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

Fetching master branch with tags associated with it

From
DSDominik Salvet <dominik.salvet@gmail.com>
Date
Feb 21, 2019, 17:02 UTC
Message-ID
<CAEXP2g92_pnbh4_V8VOgzzdUv6w5eDhCsXf=+NOdsRwyjQUb5A@mail.gmail.com>

Dear Git community, For quite some time I am trying to solve a problem with fetching the master branch from a remote with tags that are pointing only to the master branch.

Cloning the master branch of a repository with tags only pointing to that branch is working, though. In this case, the following command will do the work: `git clone --branch master --single-branch <url> .`

Now, I want to refresh the repository the same way - fetching only commits from the master branch and tags that are pointing to the master branch and also refresh those tags as well in case of their target commit change at the remote (you can expect that it always points to a master commit). Nevertheless, I don't really know how to do it. The closest I got, are the following commands:

```sh git fetch --tags origin master && git merge FETCH_HEAD ```

However, there obviously are some problems with this solution. The `--tags` flag will cause to fetch tags from all branches. Furthermore, it will fetch also their commits, which is absolutely what I don't want to.

I have Git 2.17.1 (on Ubuntu 18.04.2) and in its `git fetch --help` is stated, if I understood it correctly, that without passing neither `--tags` nor `--no-tags`, it will do exactly what I want. Nevertheless, without using any of the mentioned flags, it behaves more like using `--no-tags`.

Am I missing something? Do you want any additional information? I would really appreciate your help.

Thank you for all your effort
-- 
Dominik Salvet
Next: Jeff King
Message 1 of 3 in “Fetching master branch with tags associated with it”
  1. Dominik SalvetFeb 21, 2019
  2. Jeff KingFeb 22, 2019
  3. Randall S. BeckerFeb 22, 2019

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.