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
Asheesh Laroia <asheesh@asheesh.org>
Date
Jan 23, 2009, 02:55 UTC
Message-ID
<alpine.DEB.2.00.0901222101520.14992@vellum.laroia.net>
In-Reply-To
<20090123094509.6117@nanako3.lavabit.com>
On Fri, 23 Jan 2009, Nanako Shiraishi wrote:
> 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.
Thanks for seeing this!
> 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.

During a merge where the file called "file" is in conflict, I don't see why the internal mechanism of how a merge gets resolved is important to users like Nathan.

Sure, the index is nice, but let's look at the choices here. When he runs $ git commit file -m 'fixed conflict' git can do one of two things:

(a) Fail with an obscure (or less obscure) error message, or (b) Succeed.

The way in which it can suceed is unambiguous. Now, in the case of more than one file being in conflict, it makes sense to abort; success isn't possible. But in this case, no one really benefits from the user having to type something else to have the command actually succeed.

Those are my thoughts.
> The answer of course can be "because it changes the behavior people are 
> very much used to."

I don't think anyone is "very much used to" this error message, or that making something succeed in the only possible way is going to confuse anyone. If you're worried about confusing people, git could print a note like:

 	$ git commit file -m "Fixed conflict"
 	NOTE: Merge was in progress. If you have more than one file in conflict
 	in a future merge, be sure to "git add" each file separately and then
 	commit them all at once.
 	Created commit 12ede36: Fixed conflict
 	 0 files changed, 0 insertions(+), 0 deletions(-)
 	 create mode 100644 file
 	$
-- Asheesh.
-- 
In the Spring, I have counted 136 different kinds of weather inside of
24 hours.
 		-- Mark Twain, on New England weather
Previous: Nanako ShiraishiNext: Junio C Hamano
Message 6 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.