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

Antw: Surprising semantics of "git add file"

From
UWUlrich Windl <ulrich.windl@rz.uni-regensburg.de>
Date
May 5, 2019, 20:12 UTC
Message-ID
<5CCF43AE020000A100031092@gwsmtp.uni-regensburg.de>
In-Reply-To
<5CCF414A020000A10003108C@gwsmtp.uni-regensburg.de>
Actually things are worse: When I tried to fix the comment for the unexpected commit at least using "git commit --amend", more files were committed!
>>> Ulrich Windl 05.05.19 22.02 Uhr >>>
Hi!

Reading the manual, I realized that "it is the way it is (it works as documented)", but to me it's surprising, meaning: I feel it's wrong: (git-2.16.4) I have staged several files, and then I do "git add -interactive file" to add some selected changes from file. After that a "git diff --cached file" just shows the changes added interactively, but when I "git add file" to commit those changes), even the unstaged changes from file are committed. I feel this is inconsistent: At least "git diff --cached file" should behave like "git commit file", meaning "git commit file" should be fixed IMHO. Or are there any reasonable use cased for that?

Regards, Ulrich Windl

Previous: Ulrich WindlNext: Andreas Schwab
Message 2 of 4 in “Surprising semantics of "git add file"”
  1. Ulrich WindlMay 5, 2019
  2. Antw: Surprising semantics of "git add file"Ulrich Windl, May 5, 2019
  3. Andreas SchwabMay 5, 2019
  4. Antw: Re: Surprising semantics of "git add file"Ulrich Windl, May 6, 2019

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.