git subtree: possible to change subtree branch/path in a forked repository?

If you used git subtree (and not git submodule) to create the subtree, then it’s just a normal dir. To switch it to another branch, just delete it and recreate the subtree from the new branch. This is:

git rm <subtree>
git commit
git subtree add --prefix=<subtree> <repository_url> <branch>

That should work without problems.

Leave a Comment