简体   繁体   中英

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.

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.

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. Now add the subtree again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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