使用git pull从远程获取所有标签 [英] Fetching all tags from a remote with git pull

查看:2582
本文介绍了使用git pull从远程获取所有标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  [remoteupstream] 
url = <删节>
fetch = + refs / heads / *:refs / remotes / upstream / *

我在分支主服务器上发出 git pull ,所有远程头都被提取到远程/上游,然后远程/上游/主服务器合并到主服务器中。任何可以到达的标签也可以同时获取,这非常方便。



我想要 git pull 额外从远程获取所有标签,而不仅仅是那些可从头部直接获取的标签。我原本试着登录 tagopt == --tags ,但发现这只会导致标签被抓取,从而破坏了一切。 (Junio甚至说这是一个

=noreferrer>可怕的错误配置)。



有没有办法让 git pull 获取所有的远程标签默认情况下,除了远程头? 解决方案

你应该能够通过添加一个refspec为标记到您的本地配置。具体来说:

  [remoteupstream] 
url =< redacted>
fetch = + refs / heads / *:refs / remotes / upstream / *
fetch = + refs / tags / *:refs / tags / *


I currently have a git remote setup like the following:

[remote "upstream"]
    url = <redacted>
    fetch = +refs/heads/*:refs/remotes/upstream/*

When I issue git pull on branch master, all remote heads are fetched into remotes/upstream, then remotes/upstream/master is merged into master. Any tags that can be reached are also fetched at the same time, which is very convenient.

I'd like git pull to additionally fetch all tags from the remote, not just those that are directly reachable from the heads. I originally tried seting tagopt == --tags, but found this caused only tags to be fetch and thus broke everything. (Junio even says that's a horrendous misconfiguation).

Is there a way to make git pull fetch all remote tags by default, in addition to the remote heads?

解决方案

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/*

这篇关于使用git pull从远程获取所有标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆