前言
之前备份 hexo 的主题 next 的时候感觉很麻烦看这里, 最近某牛测试域名回收导致资源链接都失效了,又看见 next 主题更新到了 6.0,然后就试着用 git submodule 来更优雅的备份自定义的主题。
步骤
首先 fork 主题到自己仓库如
my-theme-git-repo
删除之前的
themes/next
1234567
cd hexo_bloggit 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 updatecd themes/nextgit remote add upstream https://github.com/theme-next/hexo-theme-next
自定义主题后只需要在
themes/next
下进行 pull/push, 也可以在本目录下使用 upstream 让自己的 fork 的远端仓库与原主题保持同步切换新电脑后
1234
git clone my-blog-gitcd my-blog-gitgit submodule initgit submodule update