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
Nanako Shiraishi <nanako3@lavabit.com>
Date
Dec 18, 2008, 03:34 UTC
Message-ID
<20081218123456.6117@nanako3.lavabit.com>
In-Reply-To
<c115fd3c0812171722g93dbeefw2fb5bf7641dfe394@mail.gmail.com>
Quoting "Tim Visher" <tim.visher@gmail.com>:
Show 7 quoted lines
> On Wed, Dec 17, 2008 at 5:59 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> How about omitting the "git commit" and do "git checkout PATH" after you
>> are done with the staging?  IOW, (1) above.
>
> Huh.  I guess I was under the impression that doing the `git checkout
> PATH` would destroy the staged content as well as the unstaged.  This
> isn't the case?
A short answer is "no it is not the case."
I was about to quote "git checkout" documentation to you because I was reasonably sure that Junio won't respond to people who ask a question whose answer is plainly described in the manual pages, but I think the description of the command is a little confusing especially for people who read it for the first time.
This is a patch to clarify the sentence.
-- 8< -- Cut Here -- 8< --
Subject: Clarify documentation of "git checkout <tree-ish> paths" syntax
The SYNOPSIS section of the manual writes:
    git checkout [options] [<tree-ish>] [--] <paths>...

but the DESCRIPTION says that this form checks the paths out "from the index, or from a named commit." A later sentence refers to the same argument as "<tree-ish> argument", but it is not clear that these two sentences are talking about the same command line argument for first-time readers.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
---
 Documentation/git-checkout.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 168333a..bbdfa40 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -27,7 +27,7 @@ the first namespace level.
 
 When <paths> are given, this command does *not* switch
 branches.  It updates the named paths in the working tree from
-the index file, or from a named commit.  In
+the index file, or from a named <tree-ish> (most often a commit).  In
 this case, the `-b` options is meaningless and giving
 either of them results in an error.  <tree-ish> argument can be
 used to specify a specific tree-ish (i.e. commit, tag or tree)
-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
Previous: Tim VisherNext: Tim Visher
Message 6 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.