博客写作流程

常用的 git 指令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#查看当前状态,改了哪些文件、有没有没 add 的、分支是否干净
git status

#看当前远程仓库地址
git remote -v

#测试是否能连上远程仓库
git ls-remote

#测试 SSH 是否通
ssh -T git@github.com

#修改远程仓库地址(比如 https ↔ ssh)
git remote set-url origin <远程仓库地址>

#查看 ignore 是否生效
git check-ignore -v public

#把已推送到GitHub仓库的文件删除,本地不会删除
git rm -r --cached <文件夹名> <文件名>
git commit -m "commit 备注"
git push

Front-matter

1
2
3
4
5
6
7
8
9
10
11
---
title: {{ title }}
date: {{ date }}
updated:
tags:
categories:
description:
top_img: transparent
cover:
copyright:
---

填写好标签,分类,摘要,文章封面,是否加版权信息

hexo 文章指令

生成新文章

1
hexo new <文章名> # 默认生成的是 post

此时会在博客文件夹 source\_posts 文件夹下生成一个新 markdown 文件,编写这个文件就行了

完成后正常使用 git 提交就可以了 add > commit > push

修改文章

直接修改博客文件夹 source\_posts 文件夹里的文章,修改好后

1
2
3
git add source/_posts/×××.md
git commit -m "update:xxx"
git push

删除文章

直接删除博客文件夹 source\_posts 文件夹里的文章,然后

1
2
git commit -m "remove:xxx"
git push