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

Re: git-checkout silently throws away the dirty status of index without a warning?

From
Andrew Ardill <andrew.ardill@gmail.com>
Date
Sep 2, 2011, 01:52 UTC
Message-ID
<CAH5451mU1DOb3T27U4kYCFzhSVRzmP6Z94h+5oq-K5CU71gTBg@mail.gmail.com>
In-Reply-To
<CAEvN+1hA1mUjDc0cQidEBOf5LhJ9LrVbTjyV5qPkUKNM6f7urQ@mail.gmail.com>
> I accidentally switch to the switched-to branch without committing the
> intermediate status.
> The 'work' was gone, and I had no idea how to bring it back.

Forgive me if I am missing something here, but can't you use reflog to go back to the point just before you checked the switched-to branch out?

I guess the question is in general, how do you revert to a previous instance of the working index AND previous checked out branch? I don't know the 'switch branch with modified working index' mapping well enough to be able to determine if there is a bijection possible, a concise description of it would probably show us. If not, the only way to achieve this is to keep the history available.

Regards,
Andrew Ardill
Previous: Tzu-Jung Lee
Message 6 of 6 in “git-checkout silently throws away the dirty status of index without a warning?”
  1. Tzu-Jung LeeSep 1, 2011
  2. Jeff KingSep 1, 2011
  3. Tzu-Jung LeeSep 1, 2011
  4. Junio C HamanoSep 1, 2011
  5. Tzu-Jung LeeSep 1, 2011
  6. Andrew ArdillSep 2, 2011

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.