简体   繁体   English

读取的Git子树

[英]Readd Git subtree

I added a git subtree to one of my projects recently, but due to a slew of git errors would like to "delete" and readd this subtree. 我最近向我的一个项目中添加了一个git子树,但是由于大量git错误,我们希望“删除”并读取此子树。

Is there any way I can remove the subtree, and readd it? 有什么办法可以删除子树并读取它? When manually removing it with the 'rm' command and attempting to readd with git subtree add, I get prefix 'subtreeName' already exists. 当使用'rm'命令手动删除它并尝试使用git subtree add读取时,我得到前缀'subtreeName'已经存在。

I am assuming by "remove the subtree, and readd it" again you mean you want to add the subtree again to the parent repository. 我假设通过“删除子树并读取它”再次表示您想将子树再次添加到父存储库。

If that is the case, there could be two problems here: 如果真是这样,这里可能存在两个问题:

  1. You have removed the contents inside the subtree folder, but not the subtree folder itself in the parent repository. 您已删除了子树文件夹中的内容,但未删除父存储库中的子树文件夹本身。 Remove the whole subtree folder from the start of its prefix and not just the contents inside it. 从其前缀的开头删除整个子树文件夹,而不仅仅是其中的内容。

  2. After removing the subtree, do a git add and git commit your subtree removal. 删除子树后,执行git addgit commit删除子树。 Now add the subtree again. 现在再次添加子树。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM