git删除所有commit

2022-01-04  本文已影响0人  Marshall3572

有时github在commit历史记录里会留下密码、用户信息等敏感记录,可以参照下边的方法删除历史记录。

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

上一篇 下一篇

猜你喜欢

热点阅读