Skip to content

Commit

Permalink
Removing a git commit and force pushing to remove it from history
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw authored Oct 22, 2021
1 parent 2711513 commit 7fff890
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions git/remove-commit-and-force-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Removing a git commit and force pushing to remove it from history

I accidentally triggered a commit which added a big chunk of unwanted data to my repository. I didn't want this to stick around in the history forever, and no-one else was pulling from the repo, so I decided to use force push to remove the rogue commit entirely.

I figured out the commit hash of the previous version that I wanted to restore and ran:

git reset --hard 1909f93

Then I ran the force push like this:

git push --force origin main

See https://github.com/simonw/sf-tree-history/issues/1

0 comments on commit 7fff890

Please sign in to comment.