git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Surprising semantics of "git add file"
@ 2019-05-05 20:02 Ulrich Windl
  2019-05-05 20:12 ` Antw: " Ulrich Windl
  2019-05-05 20:31 ` Andreas Schwab
  0 siblings, 2 replies; 4+ messages in thread
From: Ulrich Windl @ 2019-05-05 20:02 UTC (permalink / raw)
  To: git

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Antw: Surprising semantics of "git add file"
  2019-05-05 20:02 Surprising semantics of "git add file" Ulrich Windl
@ 2019-05-05 20:12 ` Ulrich Windl
  2019-05-05 20:31 ` Andreas Schwab
  1 sibling, 0 replies; 4+ messages in thread
From: Ulrich Windl @ 2019-05-05 20:12 UTC (permalink / raw)
  To: git

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Surprising semantics of "git add file"
  2019-05-05 20:02 Surprising semantics of "git add file" Ulrich Windl
  2019-05-05 20:12 ` Antw: " Ulrich Windl
@ 2019-05-05 20:31 ` Andreas Schwab
  2019-05-06  7:14   ` Antw: " Ulrich Windl
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2019-05-05 20:31 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: git

On Mai 05 2019, "Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de> wrote:

> 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.

Did you really mean "git add" here?  It doesn't commit, it adds to the index.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Antw: Re: Surprising semantics of "git add file"
  2019-05-05 20:31 ` Andreas Schwab
@ 2019-05-06  7:14   ` Ulrich Windl
  0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Windl @ 2019-05-06  7:14 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: git

>>> Andreas Schwab <schwab@linux-m68k.org> schrieb am 05.05.2019 um 22:31 in
Nachricht <87o94gbq46.fsf@igel.home>:
> On Mai 05 2019, "Ulrich Windl" <Ulrich.Windl@rz.uni‑regensburg.de> wrote:
> 
>> 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.
> 
> Did you really mean "git add" here?  It doesn't commit, it adds to the 
> index.

Sorry, you are right "git commit file" I meant. I guess I was distracted when
writing that. Otherwise it wouldn't make any sense.

> 
> Andreas.
> 
> ‑‑ 
> Andreas Schwab, schwab@linux‑m68k.org 
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> "And now for something completely different."




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-06  7:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-05 20:02 Surprising semantics of "git add file" Ulrich Windl
2019-05-05 20:12 ` Antw: " Ulrich Windl
2019-05-05 20:31 ` Andreas Schwab
2019-05-06  7:14   ` Antw: " Ulrich Windl

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).