git 清空所有commit记录
生活随笔
收集整理的這篇文章主要介紹了
git 清空所有commit记录
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
說明:例如將代碼提交到git倉庫,將一些敏感信息提交,所以需要刪除提交記錄以徹底清除提交信息,以得到一個干凈的倉庫且代碼不變
1.Checkout
git checkout --orphan latest_branch
2. Add all the files
git add -A
3. Commit the changes
git commit -am "commit message"
4. Delete the branch
git branch -D master
5.Rename the current branch to master
git branch -m master
6.Finally, force update your repository
git push -f origin master
轉(zhuǎn)載于:https://www.cnblogs.com/liujinyu/p/11093027.html
總結(jié)
以上是生活随笔為你收集整理的git 清空所有commit记录的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 微信小程序-路由方式
- 下一篇: 面试题之第一部分(Python基础篇)