有时候在提交代码时,不小心提交了敏感数据,如账号密码什么的,这样在历史记录中就可以查看到,这样很不安全,所以就需要吧历史提交记录删了,变成一个新的仓库。
记录一下方法:
git checkout --orphan latest_branch
git add -A
git commit -am "commit"
git branch -D master
git branch -m master
git push -f origin master
这样以后在去看master分支,就是一个全新的仓库惹,所以提交记录都没有惹
以上!