Can we set a Git default to fetch all tags during a remote pull?

前端 未结 6 778
时光说笑
时光说笑 2020-12-12 10:57

I currently have a git remote setup like the following:

[remote \"upstream\"]
    url = 
    fetch = +refs/heads/*:refs/remotes/upstream/*


        
相关标签:
6条回答
  • 2020-12-12 11:39

    I use this with magit on kernel.org

    [remote "upstream"]
        url = <redacted>
        fetch = +refs/heads/*:refs/remotes/upstream/*
        tagOpt = --tags
    
    0 讨论(0)
  • 2020-12-12 11:47

    The --force option is useful for refreshing the local tags. Mainly if you have floating tags:

    git fetch --tags --force
    

    The git pull option has also the --force options, and the description is the same:

    When git fetch is used with <rbranch>:<lbranch> refspec, it refuses to update the local branch <lbranch> unless the remote branch <rbranch> it fetches is a descendant of <lbranch>. This option overrides that check.

    but, according to the doc of --no-tags:

    By default, tags that point at objects that are downloaded from the remote repository are fetched and stored locally.

    If that default statement is not a restriction, then you can also try

    git pull --force
    
    0 讨论(0)
  • 2020-12-12 11:55

    A simple git fetch --tags worked for me.

    0 讨论(0)
  • 2020-12-12 11:56

    It's simple. Do a

    git fetch --all

    0 讨论(0)
  • 2020-12-12 11:57

    You should be able to accomplish this by adding a refspec for tags to your local config. Concretely:

    [remote "upstream"]
        url = <redacted>
        fetch = +refs/heads/*:refs/remotes/upstream/*
        fetch = +refs/tags/*:refs/tags/*
    
    0 讨论(0)
  • 2020-12-12 11:57

    For me the following seemed to work.

    git pull --tags
    
    0 讨论(0)
提交回复
热议问题