git: 如何删除本地分支机构 ref?

我略微困难地删除当地分支机构 ref /refs/notes/origin/commits/.
我能够删除分支机构 /refs/notes/origin/commits/ 在与团队的远程存储库中


git push origin :refs/notes/origin/commits


但是当我尝试在本地存储库中删除相同的分支时,我会收到以下错误


[User@centos Clone]# git branch -rd refs/notes/origin/commits
error: remote branch 'refs/notes/origin/commits' not found.


你有一些想法吗?
已邀请:

莫问

赞同来自:

做就是了


git branch -d commits


删除本地分支。

使用交换机
-D

, 无论其组合状态如何,都会消除它。

利用


git update-ref -d refs/notes/origin/commits


删除 ref.

如上所述,您也可以几乎无法删除它,使用


rm -rf .git/refs/notes

二哥

赞同来自:

您的存储库中有注释 git, 您可以删除一个注释


git notes remove <commit>


删除必须删除目录的所有注释 'notes'


rm -rf .git/refs/notes


或者您可以使用该命令 git update-ref.


git update-ref -d refs/notes/commits


</commit>

莫问

赞同来自:

您可以只需从目录中删除文件 .git. 从存储库的根源,团队,它将如何做到:


rm .git/refs/tags/refs/original/refs/heads/master


如果团队,路径可能有点不同 git-tag 失败,所以你可能想要 cd .git/refs 并找到一个侮辱性的头 trial-and-error. 删除文件将删除本地存储库中的链接。

要回复问题请先登录注册