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

Dangers of reset --hard (Re: Implicit stashes)

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jun 30, 2010, 05:13 UTC
Message-ID
<20100630051326.GA17497@burratino>
In-Reply-To
<AANLkTilTaQP6qARY1A495vm9HAvLVX_lqIQd1l3WIv7a@mail.gmail.com>
John Tapsell wrote:
Show 8 quoted lines
> $ git reset --hard
>
> I know this seems very explicit to delete changes, but I myself have
> done this and accidentally lost changes.  For example, I write a unit
> test and don't commit it in on purpose because I know that it
> currently fails and I want to test it against older versions.  I
> carefully git checkout older versions to find if the unit test fails,
> then in stupidity reset back to origin/master ..
Aside: I assume you already know about it, but still I cannot help but
take the opportunity to advertise ‘git reset --keep’.  I was added
fairly recently (1.7.1 rc0) and I find myself annoyed when on machines
without it because of almost exactly this use case.
Stephan and Christian: thanks for writing it.
Previous: AlexNext: Will Palmer
Message 6 of 8 in “Implicit stashes”
  1. John TapsellJun 30, 2010
  2. Joshua JensenJun 30, 2010
  3. John TapsellJun 30, 2010
  4. Sverre RabbelierJun 30, 2010
  5. AlexJun 30, 2010
  6. Dangers of reset --hard (Re: Implicit stashes)Jonathan Nieder, Jun 30, 2010
  7. Will PalmerJun 30, 2010
  8. Jonathan NiederJun 30, 2010

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.