From: Michael J Gruber <git@drmicha.warpmail.net>
To: Nathan Yergler <nathan@creativecommons.org>
Cc: Asheesh Laroia <asheesh@asheesh.org>,
git@vger.kernel.org, Johannes Sixt <j.sixt@viscovery.net>
Subject: Re: Short "git commit $file" syntax fails in the face of a resolved conflict
Date: Thu, 22 Jan 2009 10:17:12 +0100 [thread overview]
Message-ID: <49783998.1040400@drmicha.warpmail.net> (raw)
In-Reply-To: <c1a864630901211346j4b702fb3tcc5a098ed7e1541d@mail.gmail.com>
Nathan Yergler venit, vidit, dixit 21.01.2009 22:46:
> 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.
Because it makes it hard to follow the discussion.
Why shouldn't I?
Fist of all: Please don't top post.
;)
That being said: As Johannes 6t explained (in agreement with git help
commit), "git commit path" - which is synonymous with "git commit -o
path" is a way of bypassing the index. Think of "Oh wait, I wanted to
commit that before I commit what I'm preparing right now.". Now,
bypassing the index is no big deal, but bypassing a merge in progress
is, because a merge in progress leaves more traces than just the index
state (e.g. MERGE_HEAD). That's also why this use case is mentioned
explicitly in the man page... In fact, rereading that man page (and
testing things to be on the safe side) I have to correct myself: Out of
1) git add path && git commit
2) git commit path
3) git commit -i path
none are equivalent! 1) and 3) are equivalent if and only if "path" is
known to git already: git commit -i does not add new paths.
2) and 3) are equivalent if and only if the index is empty (no changes
staged). The question "When are 1) and 2)" equivalent is left as an
exercise in elementary logic. ;)
Cheers,
Michael
prev parent reply other threads:[~2009-01-22 9:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-21 21:00 Short "git commit $file" syntax fails in the face of a resolved conflict Asheesh Laroia
2009-01-21 21:35 ` Michael J Gruber
2009-01-21 21:46 ` Nathan Yergler
2009-01-22 7:28 ` Johannes Sixt
2009-01-23 0:45 ` Nanako Shiraishi
2009-01-23 2:55 ` Asheesh Laroia
2009-01-23 6:15 ` Junio C Hamano
2009-01-23 6:17 ` [PATCH 1/3] Add "partial commit" tests during a conflicted merge Junio C Hamano
2009-01-23 7:09 ` Johannes Sixt
2009-01-23 7:16 ` Junio C Hamano
2009-01-23 7:32 ` Johannes Sixt
2009-01-23 7:39 ` Junio C Hamano
2009-01-23 6:19 ` [PATCH 2/3] builtin-commit: shorten eye-sore overlong lines Junio C Hamano
2009-01-23 6:21 ` [PATCH 3/3] git commit: pathspec without -i/-o implies -i semantics during a merge Junio C Hamano
2009-01-23 9:51 ` Pieter de Bie
2009-01-23 17:01 ` Junio C Hamano
2009-01-22 9:17 ` Michael J Gruber [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49783998.1040400@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=asheesh@asheesh.org \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
--cc=nathan@creativecommons.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.