CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 00:22:54 GMT
server: Fly/6f91d33b9d (2025-10-08)
content-type: text/html; charset=utf-8
content-encoding: gzip
via: 2 fly.io, 2 fly.io
fly-request-id: 01K7AWS1R236GSFMF7F16MAVYV-bom
Removing a git commit and force pushing to remove it from history | Simon Willison’s TILs
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
Related
- git Rewriting a Git repo to remove secrets from the history - 2023-01-24
- git Rewriting a repo to contain the history of just specific files - 2022-03-22
- git Using git-filter-repo to set commit dates to author dates - 2023-07-10
- git How to create a tarball of a git repository using "git archive" - 2022-11-15
- git Back-dating Git commits based on file modification dates - 2024-08-01
- git git bisect - 2022-10-29
- github Clone, edit and push files that live in a Gist - 2022-09-08
- github Migrating a GitHub wiki from one repository to another - 2022-07-28
- github Assistance with release notes using GitHub Issues - 2024-08-05
- homebrew Browsing your local git checkout of homebrew-core - 2020-08-27
Created 2021-10-22T12:25:57-07:00 · Edit