nginx
//重启nginx
nginx -s reopen
//重新加载Nginx配置文件,然后以优雅的方式重启Nginx
nginx -s reload
//强制停止Nginx服务
nginx -s stop
//优雅地停止Nginx服务(即处理完所有请求后再停止服务)
nginx -s quit
yarn、npm
清除缓存
//npm
npm cache clean --force
//yarn
yarn cache clean
设置为淘宝镜像
//npm
npm config set registry https: //registry.npmmirror.com/
//yarn
yarn config set registry https: //registry.npmmirror.com/
git取消上一次的git commit 提交
1.使用git reset命令,取消之前的提交
取消上一次提交
git reset HEAD~1
或
git reset HEAD^
撤回两次或者n次
git reset HEAD~2
回到的某个commit的状态
git reset --hard <commit_SHA-1> //<commit_SHA-1>表示要回到的commit的SHA-1值
2.将修改推送到远程
git push --force origin <branch_name>
3.把 a 分支代码“覆盖/合并”到 b,但 b 只产生 1 个提交
git checkout b
git merge --squash a
git commit -m "将 a 分支的改动合并为一次提交"
- 效果:把 a 相对 a/b 共同祖先以来的所有改动一次性应用到 b,上面只生成 1 个新提交。
- 适用:你想把 a 的改动全部带到 b,但不想把 a 的提交历史(假设有10 个 commit)带过去。
4.只把 a 的某一条提交转移到 b
git checkout b
git cherry-pick <commit-hash>
常见参数与冲突处理
- 遇到冲突:解决冲突后执行
git add .
git cherry-pick --continue
- 中途放弃:
git cherry-pick --abort
- 只应用改动,不自动提交(想自己再整理后提交):
git cherry-pick -n <commit-hash> # 等价于 --no-commit
# 修改/检查后再
git commit -m "..."
- 允许编辑提交信息:
git cherry-pick -e <commit-hash>