Owning to needing to change the theme of hexo, I need a way to modify them with git submodule
. Here is a quick cheatsheet
for myself.
Why git submodule
One of the means to maintain a repository in another repository.
Cheatsheet
To add a repository:
git submodule add <repository>
To add a repository with a specific directory folder
git submodule add <repository> <direcotry>
To modify the code for a submodule
1 | $ cd submodule-folder |
To pull the latest commits for a submodule
1 | $ git submodule update remote --merge |
Specifying which branch to pull for a submodule
Open .gitmodules
and add the branch
field to the config
1 | [submodule "themes/landscape"] |