I load on git some project which contains some personal data. Now I changed all lines and commit it. Now I need to erase all commits except last one to prevent loosing personal data.
Given that your main branch is called master, and you want to remove all commits except the last one from your master:
git checkout --orphan tmpgit add . --allgit commit -m "Init."git push origin tmpgit branch -D mastergit push origin :mastergit checkout -b master git push origin mastergit branch -D tmpgit push origin :tmpIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With