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

Re: Delete a commit

From
BSBertram Scharpf <lists@bertram-scharpf.de>
Date
Dec 20, 2009, 00:43 UTC
Message-ID
<20091220004340.GA30440@marge.bs.l>
In-Reply-To
<hgjpqu$dos$1@ger.gmane.org>
Hi,
Am Sonntag, 20. Dez 2009, 01:06:46 +0100 schrieb Johan 't Hart:
Show 11 quoted lines
> Bertram Scharpf schreef:
>> I fetched a line from the shell's history and accidentally hit
>> enter before editing it. Then I had commited some work that was
>> not completed. Is there a way to get rid of that commit as if it
>> never were there?
>
> Try:
> git reset --soft HEAD~1
>
> You could also:
> git commit --amend ...
  % git fsck --lost-found
  dangling commit 6abc221327e896c850c56dafae92277bcfe68e2b
It is still there. This is the one I want to delete.
Bertram
-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de
Previous: Johan 't HartNext: Pascal Obry
Message 4 of 8 in “Delete a commit”
  1. Bertram ScharpfDec 19, 2009
  2. James P. Howard, IIDec 19, 2009
  3. Johan 't HartDec 20, 2009
  4. Bertram ScharpfDec 20, 2009
  5. Pascal ObryDec 20, 2009
  6. Johan 't HartDec 21, 2009
  7. Andreas SchwabDec 21, 2009
  8. Bertram ScharpfDec 21, 2009

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.