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

Re: Git reset -p on working tree

From
Jeenu V <jeenuv@gmail.com>
Date
Nov 23, 2010, 13:00 UTC
Message-ID
<AANLkTimEOULR8_PAs5iPu7z+n4DQPSyDKYg8RghZxosz@mail.gmail.com>
In-Reply-To
<AANLkTi=5w3YpYu0_WbmHud0BUkO2BqYNVezWDMkCaSj2@mail.gmail.com>
On Tue, Nov 23, 2010 at 4:28 PM, knittl <knittl89@googlemail.com> wrote:
Show 8 quoted lines
> `git reset` seldomly affects the working tree, unless using `--hard`,
> `--merge` or `--keep`, and those switches are potentially dangerous if
> you are not aware of the implications to your worktree and index.
>
> without options reset undoes a previous add, i.e. remove changes from
> the index, but not the working tree.
>
> git reset manpage mentions git-checkout:

Agreed. What I'm saying is most manuals/guides out there tips user to use 'git reset --hard' to discard changes in the working directory and restore the pristine copy of files. 'reset' then becomes synonymous to discard, and it kind of is but for a different reason. Because other commands offer -p for selective operations, one might try to discard selectively, and end up using 'git reset -p --hard', which obviously isn't going to work.

Knowing the users intention in such cases, I was suggesting the error message could hint the right command (just like git commit hints user to use git-add when one does 'git commit' with a dirty working tree).

But that's just me.
-- 
Jeenu
Previous: knittlNext: Štěpán Němec
Message 6 of 14 in “Git reset -p on working tree”
  1. Jeenu VNov 23, 2010
  2. knittlNov 23, 2010
  3. Jeenu VNov 23, 2010
  4. Jeenu VNov 23, 2010
  5. knittlNov 23, 2010
  6. Jeenu VNov 23, 2010
  7. Hint at "checkout -p" in the "reset --patch <type>" error messageŠtěpán Němec, Nov 23, 2010
  8. Jeff KingNov 23, 2010
  9. Štěpán NěmecNov 23, 2010
  10. Michael J GruberNov 25, 2010
  11. Jakub NarebskiNov 25, 2010
  12. Michael J GruberNov 25, 2010
  13. Matthieu MoyNov 25, 2010
  14. Jeff KingNov 25, 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.