Create a new post
1 | $ hexo new "My New Post" |
清除缓存
$ hexo clean
Generate static files
1 | $ hexo generate |
More info: Generating
Deploy to remote sites
1 | $ hexo deploy |
More info: Deployment
Git 的使用
Git 文件状态介绍
- 已修改(modified) ———— 表示修改了文件,但还没保存到数据库中
- 已暂存(staged) ———— 表示对一个已修改文件的当前版本做了追踪,使之包含在下次提交的快照中
- 已提交(committed)———— 表示数据已经安全的保存在本地数据库中
Git 常用命令速查表
创建版本库
1 | $ git clone <url> #克隆远程版本库 |
修改和提交
1 | $ git status #查看状态 |
查看提交历史
1 | $ git log #查看提交历史 |
撤销
1 | $ git reset --hard HEAD #撤销工作目录中所有未提交文件的修改内容 |
分支与标签
1 | $ git branch #显示所有本地分支 |
合并与衍合
1 | $ git merge <branch> #合并指定分支到当前分支 |
远程操作
1 | $ git remote -v #查看远程版本库信息 |
推送代码到远程仓库
在终端运行命令
1 | git push |
,将文件推送到远程仓库:
1 | $ git push origin master |
git push是推送命令,实际上是把本地的master分支推送到了远程仓库,相当于在远程有了一个代码仓库的备份。
使用 Git 管理文件时,每次结束工作前请依次执行
git add、git commit和git push命令将文件推送到 远程仓库。
1、查看本地分支
1 | $ git branch |
1 | 结果: |
2、 list both remote-tracking and local branches (查看所有分支)
1 | $ git branch -a |
1 | 结果: |
3、我想看一下暂存区(staging area)里的内容
1 | $ git ls-files |
结果:
1 | ➜ _posts git:(code) ✗ git ls-files |
1 | $ git ls-files --stage/-s 注:show staged contents' object name in the output |
结果:
1 | ➜ _posts git:(code) ✗ git ls-files --stage |
4、在我的post文件夹里新建一个test.md文件,并推到远程仓库
1 | $ git add "test.md" |
先拉取最新的代码
1 | git pull origin code |
结果;
1 | ➜ _posts git:(code) ✗ git pull origin code |
提交:-m后面添加提交的备注
1 | git commit -m "add test.md" |
1 | ➜ _posts git:(code) ✗ git commit -m "add test.md" |
推送到远程仓库:
1 | $ git push origin code |
结果:1
2➜ _posts git:(code) ✗ git push origin code
Everything up-to-date