How to Remove a Commit That Exposes Secrets from Git History

Updated: 30th September 2025
Tags: git

How to rebase branch

Updated: 11th November 2023
Tags: git

Git commands to remove latest commit

Updated: 12th April 2021
Tags: git

Remove commit but save current code

git reset --soft HEAD~1
git push origin master --force

Remove commit and remove commit’s code

git reset --hard HEAD~1
git push origin master --force