git subtree fetch-不需要的远程标签 [英] git subtree fetch - unwanted remote tags

查看:88
本文介绍了git subtree fetch-不需要的远程标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开始使用git子树.

I am getting started with git subtree.

从子树远程获取时,我注意到的一件事是,在进行git提取之后,我从该远程获取了所有标签.这些标签可能类似于v1.0.5,并且无法将标签与其他遥控器区分开.

When fetching from a subtree remote, one thing I notice is that after a git fetch, I have all the tags from this remote. These tags could be something like v1.0.5, and it is impossible to distinguish tags from different remotes.

从技术上讲,这种行为并不奇怪.但这仍然是不可取的.

This behavior is technically not surprising. But it is still undesirable.

一种解决方案可能是使用git fetch -n省略标签.

One solution could be to omit the tags with git fetch -n.

我想知道这是推荐的做事方式,还是人们做的事更聪明.到目前为止,我没有阅读-n选项.

I wonder if this is the recommended way to do things, or if there is something smarter that people do. The -n option is not mentioned in the tutorials I read so far.

注意:我正在按照此处所述使用git子树,即手动"方法.

Note: I am using git subtree as described here, the "manual" approach.

注意:只需确认git fetch -n的答案就可以完全有效且可以接受-理想情况下使用一个或两个链接.

Note: An answer that simply confirms the git fetch -n can be perfectly valid and acceptable - ideally with a link or two.

推荐答案

我有以下3行可与子树一起使用

I have the following 3 lines to work with subtree

git remote add <alias> <url>
git config --local --add remote.<alias>.fetch +refs/tags/*:refs/tags/<alias>/*
git config remote.<alias>.tagopt --no-tags

每次调用git fetch <alias>时,该遥控器的标签信息都存储在一个子文件夹中. 命令git ls-remote --tags <alias>最终列出了这些标签.

Everytime you call git fetch <alias> the tag information of that remote is stored in a subfolder. The command git ls-remote --tags <alias> eventually lists these tags.

这篇关于git subtree fetch-不需要的远程标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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