備份
- 確認.gitignore 內如是否包含如下
1
2
3
4
5
6
7.DS_Store
Thumbs.db
db.json
*.log
node_modules/
public/
.deploy*/ - Git指例
1
2
3
4
5
6
7
8
9
10
11
12git init
#建立git儲存庫(原本就存在gitignore是因為hexo本身就會產生)
git checkout -b hexo
#建立一個名為hexo的分支,用來存放備份資料
git add .
#將目前目錄下的內容加入git追蹤
git commit -m "第一次備份"
#寫入儲存庫
git remote add origin https://github.com/username/username.github.io.git
#加入遠端儲存庫位址(基本上只要第一次)(註:不要跟著我打網址,要看您的遠端位址)
git push --setupstream=origin/hexo
#推送本次commit到遠端資儲存庫
還原
1 | hexo init |
備份的版本跟新地點一樣
覆蓋就可以了
備份的版本比新地點還舊
將舊的_config.yml逐一對照新的_config.yml,逐一修改在新的_config.yml上.並確認您的模組及theme是否還會正常.例如:hexo-math在Hexo4.1之後就會出現出錯.(需要找其他替代模組)