{"thread":{"id":"21994","subject":"Delete a commit","startedAt":"2009-12-19T23:39:57Z","lastAt":"2009-12-21T21:01:37Z","messageCount":8,"participants":["Bertram Scharpf","Johan 't Hart","James P. Howard, II","Pascal Obry","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"130165","messageId":"20091219233957.GC29111@marge.bs.l","threadId":"21994","inReplyTo":null,"subject":"Delete a commit","fromName":"Bertram Scharpf","fromEmail":"lists@bertram-scharpf.de","sentAt":"2009-12-19T23:39:57Z","receivedAt":"2009-12-19T23:39:57Z","isPatch":false,"sender":{"key":"lists@bertram-scharpf.de","avatar":null},"body":"Hi,\n\nI fetched a line from the shell's history and accidentally hit\nenter before editing it. Then I had commited some work that was\nnot completed. Is there a way to get rid of that commit as if it\nnever were there?\n\nThanks in advance.\n\nBertram\n\n\n-- \nBertram Scharpf\nStuttgart, Deutschland/Germany\nhttp://www.bertram-scharpf.de\n"},{"id":"130169","messageId":"20091219234327.GA45385@byzantine.jameshoward.us","threadId":"21994","inReplyTo":"20091219233957.GC29111@marge.bs.l","subject":"Re: Delete a commit","fromName":"James P. Howard, II","fromEmail":"jh@jameshoward.us","sentAt":"2009-12-19T23:43:27Z","receivedAt":"2009-12-19T23:43:27Z","isPatch":false,"sender":{"key":"jh@jameshoward.us","avatar":"https://avatars.githubusercontent.com/u/156522?v=4"},"body":"On Sun, Dec 20, 2009 at 12:39:57AM +0100, Bertram Scharpf wrote:\n\n> I fetched a line from the shell's history and accidentally hit\n> enter before editing it. Then I had commited some work that was\n> not completed. Is there a way to get rid of that commit as if it\n> never were there?\n\nIf you have committed nothing else in the interim, \n\n  git reset HEAD~1\n\nJames\n\n-- \nJames P. Howard, II, MPA MBCS\njh@jameshoward.us\n"},{"id":"130167","messageId":"hgjpqu$dos$1@ger.gmane.org","threadId":"21994","inReplyTo":"20091219233957.GC29111@marge.bs.l","subject":"Re: Delete a commit","fromName":"Johan 't Hart","fromEmail":"johanthart@gmail.com","sentAt":"2009-12-20T00:06:46Z","receivedAt":"2009-12-20T00:06:46Z","isPatch":false,"sender":{"key":"johanthart@gmail.com","avatar":"https://gravatar.com/avatar/f7bd2928a1a23e971f4ab68a6c7b35d7ff0efb1c225c570430badf90e404e50b?d=mp&s=160"},"body":"Bertram Scharpf schreef:\n> Hi,\n> \n> I fetched a line from the shell's history and accidentally hit\n> enter before editing it. Then I had commited some work that was\n> not completed. Is there a way to get rid of that commit as if it\n> never were there?\n\nTry:\ngit reset --soft HEAD~1\n\nYou could also:\ngit commit --amend ...\n\nwhen you realy finish the commit.\n\n> \n> Thanks in advance.\n> \n> Bertram\n> \n> \n"},{"id":"130173","messageId":"20091220004340.GA30440@marge.bs.l","threadId":"21994","inReplyTo":"hgjpqu$dos$1@ger.gmane.org","subject":"Re: Delete a commit","fromName":"Bertram Scharpf","fromEmail":"lists@bertram-scharpf.de","sentAt":"2009-12-20T00:43:40Z","receivedAt":"2009-12-20T00:43:40Z","isPatch":false,"sender":{"key":"lists@bertram-scharpf.de","avatar":null},"body":"Hi,\n\nAm Sonntag, 20. Dez 2009, 01:06:46 +0100 schrieb Johan 't Hart:\n> Bertram Scharpf schreef:\n>> I fetched a line from the shell's history and accidentally hit\n>> enter before editing it. Then I had commited some work that was\n>> not completed. Is there a way to get rid of that commit as if it\n>> never were there?\n>\n> Try:\n> git reset --soft HEAD~1\n>\n> You could also:\n> git commit --amend ...\n\n  % git fsck --lost-found\n  dangling commit 6abc221327e896c850c56dafae92277bcfe68e2b\n\nIt is still there. This is the one I want to delete.\n\nBertram\n\n\n-- \nBertram Scharpf\nStuttgart, Deutschland/Germany\nhttp://www.bertram-scharpf.de\n"},{"id":"130184","messageId":"4B2DE24A.7040402@obry.net","threadId":"21994","inReplyTo":"20091220004340.GA30440@marge.bs.l","subject":"Re: Delete a commit","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2009-12-20T08:37:30Z","receivedAt":"2009-12-20T08:37:30Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Le 20/12/2009 01:43, Bertram Scharpf a écrit :\n>   % git fsck --lost-found\n>   dangling commit 6abc221327e896c850c56dafae92277bcfe68e2b\n> \n> It is still there. This is the one I want to delete.\n\nWell, it is deleted (not accessible from any ref). It will be purged\nfrom the repository at some point after a \"git gc\".\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|    http://www.obry.net  -  http://v2p.fr.eu.org\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B\n"},{"id":"130220","messageId":"hgocfi$pge$1@ger.gmane.org","threadId":"21994","inReplyTo":"20091220004340.GA30440@marge.bs.l","subject":"Re: Delete a commit","fromName":"Johan 't Hart","fromEmail":"johanthart@gmail.com","sentAt":"2009-12-21T17:49:36Z","receivedAt":"2009-12-21T17:49:36Z","isPatch":false,"sender":{"key":"johanthart@gmail.com","avatar":"https://gravatar.com/avatar/f7bd2928a1a23e971f4ab68a6c7b35d7ff0efb1c225c570430badf90e404e50b?d=mp&s=160"},"body":"Bertram Scharpf schreef:\n> Hi,\n\n>   % git fsck --lost-found\n>   dangling commit 6abc221327e896c850c56dafae92277bcfe68e2b\n> \n> It is still there. This is the one I want to delete.\n\nIt is not in the history of any head anymore, so you could consider it \ndeleted. ('git log' does not show this commit)\n\nIf you want to prune unreferenced objects, try:\ngit prune\n\n('git help prune' for options)\n\n\n> Bertram\n> \n> \n"},{"id":"130221","messageId":"m2bphsdwds.fsf@igel.home","threadId":"21994","inReplyTo":"hgocfi$pge$1@ger.gmane.org","subject":"Re: Delete a commit","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2009-12-21T18:17:51Z","receivedAt":"2009-12-21T18:17:51Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Johan 't Hart <johanthart@gmail.com> writes:\n\n> Bertram Scharpf schreef:\n>> Hi,\n>\n>>   % git fsck --lost-found\n>>   dangling commit 6abc221327e896c850c56dafae92277bcfe68e2b\n>>\n>> It is still there. This is the one I want to delete.\n>\n> It is not in the history of any head anymore, so you could consider it\n> deleted. ('git log' does not show this commit)\n\nExcept through the reflog, most likely.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"130224","messageId":"20091221210137.GA17695@marge.bs.l","threadId":"21994","inReplyTo":"hgocfi$pge$1@ger.gmane.org","subject":"Re: Delete a commit","fromName":"Bertram Scharpf","fromEmail":"lists@bertram-scharpf.de","sentAt":"2009-12-21T21:01:37Z","receivedAt":"2009-12-21T21:01:37Z","isPatch":false,"sender":{"key":"lists@bertram-scharpf.de","avatar":null},"body":"Hi,\n\nAm Montag, 21. Dez 2009, 18:49:36 +0100 schrieb Johan 't Hart:\n> Bertram Scharpf schreef:\n>\n>>   % git fsck --lost-found\n>>   dangling commit 6abc221327e896c850c56dafae92277bcfe68e2b\n>> It is still there. This is the one I want to delete.\n>\n> It is not in the history of any head anymore, so you could consider it \n> deleted. ('git log' does not show this commit)\n>\n> If you want to prune unreferenced objects, try:\n> git prune\n>\n> ('git help prune' for options)\n\nIn the meantime I detected the gc.pruneExpire config variable. I\ndidn't get that to work on all versions that I have installed on\ndifferent machines, but I just wanted to understand what has to\nhappen with the commit.\n\nThank you!\n\nBertram\n\n\n-- \nBertram Scharpf\nStuttgart, Deutschland/Germany\nhttp://www.bertram-scharpf.de\n"}]}