往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