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

Re: Short "git commit $file" syntax fails in the face of a resolved conflict

From
Nanako Shiraishi <nanako3@lavabit.com>
Date
Jan 23, 2009, 00:45 UTC
Message-ID
<20090123094509.6117@nanako3.lavabit.com>
In-Reply-To
<4978202C.3090703@viscovery.net>
Quoting Johannes Sixt <j.sixt@viscovery.net>:
Show 18 quoted lines
> Please don't top-post.
>
> Nathan Yergler schrieb:
>> Can you elaborate on why doing -i automatically is a bad idea in this
>> case?  [It may really be, I don't pretend to have enough knowledge
>> about git's internals to make a reasoned argument.]  This was
>> unexpected behavior for me as I'd always experienced "git add path &&
>> git commit" and "git commit path" as being equivalent and so I assumed
>> they would work equivalently in this situation.
>
> They are not equivalent. 'git add path && git commit' commits changes to
> path *in addition* to what is already staged before you run this command
> sequence. But 'git commit path' commits *only* changes to path, leaving
> other changes that might be staged uncommitted.
>
> It may become obvious why the latter behavior is unwanted if a merge is in
> progress: The merge left changes (and conflicts) in the index; but with
> 'git commit path' you say that you are not interested in what the index has.
Your explanation is a good answer to Nathan's misunderstanding; "git add path && git commit" and "git commit path" are different.
But Nathan's first sentence is a different matter. I do not think it is coming from the same confusion, and I think the question is a valid one. Your answer does not explain why it is a bad idea to change the behavior of "git commit path" to what "git commit -i path" does during a merge.
The answer of course can be "because it changes the behavior people are very much used to."
-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
Previous: Johannes SixtNext: Asheesh Laroia
Message 5 of 17 in “Short "git commit $file" syntax fails in the face of a resolved conflict”
  1. Asheesh LaroiaJan 21, 2009
  2. Michael J GruberJan 21, 2009
  3. Nathan YerglerJan 21, 2009
  4. Johannes SixtJan 22, 2009
  5. Nanako ShiraishiJan 23, 2009
  6. Asheesh LaroiaJan 23, 2009
  7. Junio C HamanoJan 23, 2009
  8. 1/3 Add "partial commit" tests during a conflicted mergeJunio C Hamano, Jan 23, 2009
  9. Johannes SixtJan 23, 2009
  10. Junio C HamanoJan 23, 2009
  11. Johannes SixtJan 23, 2009
  12. Junio C HamanoJan 23, 2009
  13. 2/3 builtin-commit: shorten eye-sore overlong linesJunio C Hamano, Jan 23, 2009
  14. 3/3 git commit: pathspec without -i/-o implies -i semantics during a mergeJunio C Hamano, Jan 23, 2009
  15. Pieter de BieJan 23, 2009
  16. Junio C HamanoJan 23, 2009
  17. Michael J GruberJan 22, 2009

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.