git 清空全部commit记录方法

说明:例如将代码提交到git仓库,将一些敏感信息提交,因此须要删除提交记录以完全清除提交信息,以获得一个干净的仓库且代码不变git

1.Checkout

git checkout --orphan latest_branchit

2. Add all the files

git add -Aast

3. Commit the changes

git commit -am "commit message"test

4. Delete the branch

git branch -D masterdate

5.Rename the current branch to master

git branch -m masterfile

6.Finally, force update your repository

git push -f origin masterco

相关文章
相关标签/搜索