git删除历史提交记录

git操作技巧

** 我们在git操作过程中,如果遇到push某个log有问题,要删除此记录,怎么办?请看下文。**

清除Github提交历史记录,回到某个commmit

1、git reset --hard 176e9657476dd465476788551dc7e774ce29e2db
2、git push origin HEAD --force

大功告成~

git 远程删除某个文件

1.cd/...
2.ll
3.rm package-lock.json
sucess!!!

github提交代码x

echo "# koa" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/ioth5/koa.git
git push -u origin master

彻底清除Github上某个文件的历史操作记录

解决方法:
本地Linux命令行下分六步
首先cd 进入项目文件夹下,然后执行以下代码

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch 文件
名' --prune-empty --tag-name-filter cat -- --all

 
git push origin master --force
 
rm -rf .git/refs/original/
 
git reflog expire --expire=now --all
 
git gc --prune=now
 
git gc --aggressive --prune=now

切换镜像一些常用的命令

默认的npm下载地址:http://www.npmjs.org/ 
淘宝npm镜像的地址:https://npm.taobao.org/

临时使用淘宝源
npm --registry https://registry.npm.taobao.org install node-red-contrib-composer@latest
1.全局配置切换到淘宝源
npm config set registry https://registry.npm.taobao.org

2.全局配置切换到官方源
npm config set registry http://www.npmjs.org

3.检测是否切换到了淘宝源
npm info underscore
发布了14 篇原创文章 · 获赞 3 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/ioth5/article/details/104183498