Skip to content
Snippets Groups Projects
Select Git revision
  • 6de381eff53583d9a79478b5c29a3fdbd62095c4
  • retry-urlopen default
  • master
3 results

update_repos

  • Will Thompson's avatar
    6de381ef
    Fetch tags outside branches' histories · 6de381ef
    Will Thompson authored
    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.
    6de381ef
    History
    Fetch tags outside branches' histories
    Will Thompson authored
    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.