Disclaimer, I suspect that I am only a few days ahead of you about the subtree :-)
If you use only git subtree push , you do not give the subtree enough information to extract and modify your changes.
If you cloned the repo correctly, the subtree will already be there. Subtree needs to be told which subtree you want to click on (even if you have one), and it also needs to know where to click - in particular, you don't want to click on the top-level repo. Therefore, you want something like:
git subtree push --prefix=lib git@github.com:arges-github/lib.git master
Obviously, repo and refspec should be changed to suit your repo.
If you want to see what happens here (and it helps), then the subtree actually splits the changes that affect the files inside the subtree to another branch, and then pushes them into the subtree repository. For this to happen, use subtree split
git subtree split --rejoin --branch=shared-changes --prefix=lib
then look at the branch you made:
git checkout lib-changes
and, click them manually
git push git@github.com:arges-github/lib.git master
If this does not work, you may not have combined the subtree into your repo. When you add a subtree:
git subtree add --squash --prefix lib git@github.com:arges-github/lib.git master
you also need to merge the subtree and return it back to the top-level repository.
git subtree pull --squash --prefix lib git@github.com:arges-github/lib.git master git push
Roger Nolan
source share