From 6de381eff53583d9a79478b5c29a3fdbd62095c4 Mon Sep 17 00:00:00 2001 From: Will Thompson <wjt@endlessm.com> Date: Mon, 24 Jun 2019 21:42:40 +0100 Subject: [PATCH] Fetch tags outside branches' histories git help fetch says: > By default, any tag that points into the histories being fetched is > also fetched; the effect is to fetch tags that point at branches that > you are interested in. To give an example: $ mkdir /tmp/source $ cd /tmp/source $ git init $ touch /tmp/source/foo && git add foo && git commit -am foo $ git clone /tmp/source /tmp/dest $ git tag v1.0 $ git checkout -b temp $ echo "Don't lose this" > foo && git commit -am "Important" $ git tag dont-lose-this $ git checkout master $ git branch -D temp $ cd /tmp/dest $ git fetch From /tmp/source * [new tag] v1.0 -> v1.0 $ git fetch --tags From /tmp/source * [new tag] dont-lose-this -> dont-lose-this It's important that we fetch all tags because we sometimes tag a branch with 'archive/something' before force-pushing to it so we don't lose the old head of that branch; it would be sad to not back those up. --- update_repos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update_repos b/update_repos index fa776d8..9234593 100755 --- a/update_repos +++ b/update_repos @@ -22,7 +22,7 @@ GITHUB_API_HOST = 'https://api.github.com' GIT_CLONE_CMD = 'git clone %s %s %s' GIT_CLONE_API_URL = 'https://%s@github.com/%s' GIT_SHA_CMD = 'git rev-parse --short %s' -GIT_FETCH_CMD = 'git fetch --prune' +GIT_FETCH_CMD = 'git fetch --prune --tags' GIT_CHECK_REMOTE_CMD = 'git ls-remote' USER_DETAILS_PATH = '/users/%s' -- GitLab