获取git时缺少引用/注释
我有一种情况,我试图使用以下方法获取远程git笔记:获取git时缺少引用/注释,git,git-notes,Git,Git Notes,我有一种情况,我试图使用以下方法获取远程git笔记: git fetch origin refs/notes/*:refs/notes/* 在存储库的全新克隆上,这可以正常工作。它将下拉2个注释名称空间: > git fetch origin refs/notes/"*":refs/notes/"*"
git fetch origin refs/notes/*:refs/notes/*
在存储库的全新克隆上,这可以正常工作。它将下拉2个注释名称空间:
> git fetch origin refs/notes/"*":refs/notes/"*" <system> <dev>
From ssh://url/android-client
* [new ref] refs/notes/git-ratchet-1-3.2 -> refs/notes/git-ratchet-1-test
* [new ref] refs/notes/git-ratchet-1-dev -> refs/notes/git-ratchet-1-test2
>git获取源代码refs/notes/“*”:refs/notes/“*”
从…起ssh://url/android-client
*[新参考]参考文件/notes/git-ratchet-1-3.2->参考文件/notes/git-ratchet-1-test
*[新参考]参考文件/notes/git-ratchet-1-dev->refs/notes/git-ratchet-1-test2
然而,在我当前的项目存储库中,当我进行该获取时,我只得到一个引用。如果我手动删除.git/refs/notes/git-ratchet-1-test中的文件,然后再次尝试获取,我将下拉该文件/ref
为什么我不拆下另一个/refs/notes/git-ratchet-1-test2
?关键在于:
如果我手动删除.git/refs/notes/git-ratchet-1-test中的文件并再次尝试获取
您正在手动提供一个refspec,refs/notes/*:refs/notes/*
。这是一个“非强制”refspec,意思是:“如果我已经有一个ref,不要更新我的,保留我现有的ref”
要使其成为一个更新强制参考规范,请在前面添加一个+
如果您总是希望提取笔记(强制或不强制),请更新该遥控器的git配置
,将该refspec添加到fetch
集中。例如,而不是:
[remote "origin"]
url = git://git.kernel.org/pub/scm/git/git.git
fetch = +refs/heads/*:refs/remotes/origin/*
你可以这样说:
[remote "origin"]
url = git://git.kernel.org/pub/scm/git/git.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/notes/*:refs/notes/*
(每个遥控器可以有任意多的fetch=
行)。逻辑是合理的,尽管在执行git fetch origin+refs/notes/*:refs/notes/*
后,我仍然没有看到丢失的注释。我遗漏了一个步骤吗?不要认为你遗漏了什么,只要你确保你的外壳没有吃掉*
s(如果需要,以某种方式引用它们)。