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

git reset -- path weirdness

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Nov 3, 2007, 11:17 UTC
Message-ID
<20071103111743.GA29358@atjola.homenet>
Hi,

I noticed some weirdness with git reset when a path is given. Basically it seems to cycle the file through 3 states: unstaged, unmerged, deleted(!) which is IMHO weird at best. A bisection showed that the behaviour was introduced with the shell -> conversion of git-reset.

Extra annoyance is caused by the fact that "git status" tells you to add the file when it is in the unmerged state, but that doesn't do anything.

Log of "git reset" switching through the states:

doener@atjola:git (master) $ git status # On branch master nothing to commit (working directory clean)

doener@atjola:git (master) $ git reset -- builtin-reset.c builtin-reset.c: needs merge

doener@atjola:git (master) $ git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # # unmerged: builtin-reset.c # no changes added to commit (use "git add" and/or "git commit -a")

doener@atjola:git (master) $ git reset -- builtin-reset.c

doener@atjola:git (master) $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # deleted: builtin-reset.c # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # builtin-reset.c

doener@atjola:git (master) $ git reset -- builtin-reset.c

doener@atjola:git (master) $ git status # On branch master nothing to commit (working directory clean)

Thanks, Björn

Next: Johannes Schindelin
Message 1 of 3 in “git reset -- path weirdness”
  1. Björn SteinbrinkNov 3, 2007
  2. Johannes SchindelinNov 3, 2007
  3. git-reset: do not be confused if there is nothing to resetJohannes Schindelin, Nov 3, 2007

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.