Skip to content
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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment