hexo博客更新命令
约 545 字大约 2 分钟
bloghexo
2025-03-02
hexo静态博客框架中各个目录的作用
- .deploy_git: 这个应该是git部署用的文件。比如你写好的博客想部署到 GitHub Pages上去的话,可以用git部署插件,那个插件会创建这个目录
- node_modules: 这个应该是node.js用到的安装到当前“项目/目录”的插件/模块目录吧。毕竟hexo是通过npm安装的吧?
- public: 这应该是hero编译之后的网站的目录
- .gitignore: 这是一个git的配置文件,里面定义了不列入git管理的内容设置
- db.json: 这个我也不知道。
创建新文章
你可以执行下列命令来创建一篇新文章或者新的页面。
hexo new [layout] <title>
您可以在命令中指定文章的布局(layout),默认为 post。
更新博客
hexo clean
hexo g
由于我的博客部署在github的其他仓库中,所以先在根目录下的public/index.html
中"hostname":"username.github.io"
改为"hostname":"username.github.io/仓库名"
然后再执行:
hexo d
使用git上传源码文件到github
创建私人仓库后在根目录执行:
git init
git remote add origin https://github.com/username/仓库名.git
git add .
git status (查看现在的状态,也可以不看,随你啦)
git commit -m "这里是注释"
git push origin main
1. 恢复某个版本(先用git status查看是否改动)
git log
git reset --hard 76eac54
2. 删除所有Commit提交记录
- (1)创建孤立分支,并切换到该分支:
git checkout --orphan latest_branch
- (2)暂存所有文件:
git add -A
- (3)提交所有更改:
git commit -am "First Commit"
- (4)删除主分支 master:
git branch -D master
- (5)重命名当前分支为 master:
git branch -m master
- (6)强制推送本地分支:
git push -f origin master
删除旧的reflog条目
git reflog expire --expire=90.days.ago --expire-unreachable=now --all
相关连接
上传至github https://zhuanlan.zhihu.com/p/136355306
出现错误 https://blog.csdn.net/junruitian/article/details/88361895
Git:恢复某个版本 https://zhuanlan.zhihu.com/p/138501112
Git:删除所有Commit提交记录 https://zhuanlan.zhihu.com/p/347385535
Git:删除旧的reflog条目 https://www.coder.work/article/1530687