Git submodule notes
Update submodule
First time need to init the submodule.git submodule update --recursive --remote --init PATH
otherwisegit submodule update --recursive --remote
In this post, I noted for setup/update git submodule. In some scenarios, we developed in a project, which depends on some other library. If we want to separately version controlling both of them,
git submoduleis a good tool for that.
For example, I use Hexo to manage my blog, and in the repository there is a themes module to setup the blog theme.
Add submodule
cd BLOG_DIR |
Suppose someone else update and push the submodule in the remote repository, we may need to update the submodule.
Update submodule
First time need to init the submodule.git submodule update --recursive --remote --init PATH
otherwisegit submodule update --recursive --remote
Sometimes, we may encounter some problem of adding submodule, i.e. 'projectfolder' already exists in the index. Here is a way to fix it:
Fix issue of adding submodule
git rm --cached projectfolder |