git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Obliterating a commit

From
Wincent Colaiuta <win@wincent.com>
Date
Sep 30, 2007, 11:32 UTC
Message-ID
<D2BD14BD-44F2-4D01-AAEE-6CBC2A2DE85B@wincent.com>

A couple of days ago I mistakenly checked in a file that had some confidential information in it. I immediately realized and amended my commit, and this is a local repository whose contents won't be visible until I push them out.

So how do I *really* get rid of the that commit before publishing? I couldn't find any porcelain or plumbing to do this. Do I have to manually destroy it? ie. wind back the HEAD, manually remove the commit object, the corresponding tree object, the corresponding file blobs, and probably manually remove the entry from the reflog as well?

Is there a "shortcut" wherein I can somehow mark this commit and its related tree and file blobs as unreachable, and then use git-prune to erradicate them?

Cheers, Wincent

Next: Matthias Kestenholz
Message 1 of 3 in “Obliterating a commit”
  1. Wincent ColaiutaSep 30, 2007
  2. Matthias KestenholzSep 30, 2007
  3. Wincent ColaiutaSep 30, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.