【发布时间】:2017-06-08 09:26:27
【问题描述】:
我创建了一个沙箱 git 存储库,其中包含一些提交和几个标签,一个是轻量级的,一个是带注释的:
> mkdir one; cd one; git init
> touch a.txt; git add a.txt; git commit -m"a.txt"
> touch b.txt; git add b.txt; git commit -m"b.txt"
> git tag light
> touch c.txt; git add c.txt; git commit -m"c.txt"
> git tag -a annot -m"annot"
我现在创建第二个存储库并从第一个获取:
> mkdir two; cd two; git init
> git remote add one <...>/one
> git fetch one master
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 9 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (9/9), done.
From <...>/one
* branch master -> FETCH_HEAD
* [new branch] master -> one/master
为什么两个标签都没有被提取?我预计他们会是,基于the documentation for git fetch:
默认情况下,任何指向正在获取的历史的标签也会被获取;效果是获取指向您感兴趣的分支的标签。
【问题讨论】:
-
你试过
git fetch --all -
我几乎可以肯定 Git 的标签处理多年来发生了显着变化,所以:您运行的是哪个 Git 版本? (而且,如果这是在两台不同的机器上,你使用的是什么 URL 方案,http:// vs git:// vs ssh://,并给出两台机器的 Git 版本......)
-
@crai -
git fetch --tags one master和普通git fetch one都获取one/master分支以及light和annot标签。但是,git fetch one master没有获取标签 - 我试图了解原因。 -
@torek - 我使用的是最新的 git 版本,2.11.0。两个存储库都在同一台机器上,使用
file://URL 方案。