前言
之前备份 hexo 的主题 next 的时候感觉很麻烦看这里, 最近某牛测试域名回收导致资源链接都失效了,又看见 next 主题更新到了 6.0,然后就试着用 git submodule 来更优雅的备份自定义的主题。
步骤
首先 fork 主题到自己仓库如
my-theme-git-repo
删除之前的
themes/next
1
2
3
4
5
6
7cd hexo_blog
git rm -r --cached themes/next/
rm -rf themes/next/
git submodule add my-theme-git themes/next/大专栏 使用 git submodule 备份 hexo 的主题an>
set up remote upsteam to update
cd themes/next
git remote add upstream https://github.com/theme-next/hexo-theme-next自定义主题后只需要在
themes/next
下进行 pull/push, 也可以在本目录下使用 upstream 让自己的 fork 的远端仓库与原主题保持同步切换新电脑后
1
2
3
4git clone my-blog-git
cd my-blog-git
git submodule init
git submodule update