Common error while updating a git submodule:
fatal: reference is not a tree: 9b65a5f376fd806c5f989f0a69e00ada391dabf4
Unable to checkout '9b65a5f376fd806c5f989f0a69e00ada391dabf4' in submodule path 'path/to/submodule'
git submodule sync
git submodule update
If you have a main git versioned project and need to include a sub-project the answer is: git submodules. The problem is they are a pain to implement and to maintain!
Luckily Felix Geisendörfer‘s approach simplified this process. He proposes using “fake submodules”:
Meet fake submodules. The idea is simple, instead of using actual submodules, you just trick git into thinking the files belong to the main repository while having the respective sub-dirs remain independent clones. Doing that is simple:
$ cd my-project
$ git clone <subproject-url> my-subproject
$ git add my-subproject/
The important part is the “/” (slash) at the end of the last command. If you omit that, git will automatically assume you want to add ‘my-subproject’ as a submodule. But if you don’t, git just sees the files in the sub-directory and ignores that fact that its a git-repo of its own.
The cool thing is that you can now update a fake sub-module to the latest version as simple as:
$ cd my-subproject
$ git pull
This works because when you are inside my-subproject, git uses the ‘.git’ folder closest to it which is my-subproject/.git. If the sub project is your own, you could even push your changes to it upstream without changing projects.
You can read the original post and discussion here.