Search code examples
androidgitgit-subtree

Git remove subtree or change directory of subtree


I am trying to synchronize with updates for my subtree by doing

git pull -s subtree react master

but the whole repo is copied into wrong folder not the one I mention while adding a new repository as a subtree.

How can I remove subtree or change directory of subtree?


Solution

  • To update a subtree checked out in [directory], I would use :

    git subtree pull -P [directory] react master
    

    • renaming the subtree folder from path1 to path2 :

      git mv path1 path2
      

      and use path2 in all subsequent git subtree commands

    • deleting the subtree at path1 :

      git rm -rf path1