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