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

相關文章
相關標籤/搜索