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

Re: Is it possible to roll back unstaged changes while leaving the staged ones for the next commit?

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 17, 2008, 20:30 UTC
Message-ID
<7vy6yelf2m.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<c115fd3c0812171157m3d180534gb5630fbcf39b2bbd@mail.gmail.com>
"Tim Visher" <tim.visher@gmail.com> writes:
> My question is this: is it possible to revert the changes that I
> haven't staged so that the file looks as if everything inside of it
> has been staged because none of the stuff I didn't stage is there
> anymore.

The last part of the sentence after "because" does not parse for me at all, but I think you are after one of the following:

 (1) if you want to get rid of garbage changes in your work tree, you
     would want "git checkout $that_path";
 (2) if you want to temporarily stash away further changes in your work
     tree, because you would want to first test what is staged, commit it,
     and then later continue to refine the changes stashed away thusly,
     you would want "git stash --keep-index".
Previous: Tim VisherNext: Tim Visher
Message 2 of 7 in “Is it possible to roll back unstaged changes while leaving the staged ones for the next commit?”
  1. Tim VisherDec 17, 2008
  2. Junio C HamanoDec 17, 2008
  3. Tim VisherDec 17, 2008
  4. Junio C HamanoDec 17, 2008
  5. Tim VisherDec 18, 2008
  6. Nanako ShiraishiDec 18, 2008
  7. Tim VisherDec 18, 2008

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.