Skip to content
Snippets Groups Projects
Commit 6de381ef authored by Will Thompson's avatar Will Thompson
Browse files

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.
parent 17675937
Branches
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ GITHUB_API_HOST = 'https://api.github.com' ...@@ -22,7 +22,7 @@ GITHUB_API_HOST = 'https://api.github.com'
GIT_CLONE_CMD = 'git clone %s %s %s' GIT_CLONE_CMD = 'git clone %s %s %s'
GIT_CLONE_API_URL = 'https://%s@github.com/%s' GIT_CLONE_API_URL = 'https://%s@github.com/%s'
GIT_SHA_CMD = 'git rev-parse --short %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' GIT_CHECK_REMOTE_CMD = 'git ls-remote'
USER_DETAILS_PATH = '/users/%s' USER_DETAILS_PATH = '/users/%s'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment