From: Jonathan Nieder <jrnieder@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Neal Kreitzinger <neal@rsss.com>, git@vger.kernel.org
Subject: Re: Can I checkout a single file without altering index?
Date: Fri, 15 Oct 2010 14:32:52 -0500 [thread overview]
Message-ID: <20101015193252.GA23082@burratino> (raw)
In-Reply-To: <20101015185539.GA30380@sigill.intra.peff.net>
Jeff King wrote:
> On Fri, Oct 15, 2010 at 01:43:02PM -0500, Jonathan Nieder wrote:
>> Neal Kreitzinger wrote:
>>> However, there is an option in git-commit to copy files directly from the
>>> working-tree to the object-store by totally bypassing the index
>>
>> What option is this? I thought "git commit --include" added content
>> to the index.
>
> git commit -o|--only, which is the same as "git commit <paths>". Of
> course it still uses an index, to create the tree, but it uses a
> temporary one based on HEAD instead of the current index contents.
Ah, it's stranger than that.
* A partial commit.
*
* (0) find the set of affected paths;
* (1) get lock on the real index file;
* (2) update the_index with the given paths;
* (3) write the_index out to the real index (still locked);
* (4) get lock on the false index file;
* (5) reset the_index from HEAD;
* (6) update the_index the same way as (2);
* (7) write the_index out to the false index file;
* (8) return the name of the false index file (still locked);
The net effect being that the index will match the work tree for the
listed paths when the operation is over, while other files are
untouched.
-- 8< --
Subject: Documentation: clarify "commit --only" description
>From the current description, one might imagine that "git commit
<pathspec>" bypasses the index completely. Clarify what it does
do to the index:
- paths matching <pathspec> are updated to match the work tree
- paths not matching <pathspec> are left alone
so readers can have a better idea of what the index represents
before and after such an operation.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
I'm not so happy with the wording. Hopefully this gives the idea...
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 42fb1f5..6bb3eff 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -191,9 +191,10 @@ FROM UPSTREAM REBASE" section in linkgit:git-rebase[1].)
--only::
Make a commit only from the paths specified on the
command line, disregarding any contents that have been
- staged so far. This is the default mode of operation of
- 'git commit' if any paths are given on the command line,
- in which case this option can be omitted.
+ staged so far. The state of other files in the index is
+ preserved and will not affect the commit. This is the
+ default mode of operation of 'git commit' if any paths are given
+ on the command line, in which case this option can be omitted.
If this option is specified together with '--amend', then
no paths need to be specified, which can be used to amend
the last commit without committing changes that have
next prev parent reply other threads:[~2010-10-15 19:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-12 10:03 Can I checkout a single file without altering index? Christian Halstrick
2010-10-12 10:19 ` Michael J Gruber
2010-10-12 11:14 ` Stefan Naewe
2010-10-13 17:09 ` Jared Hance
2010-10-12 15:39 ` Alex Riesen
2010-10-12 16:39 ` Tomas Carnecky
2010-10-14 8:03 ` Christian Halstrick
2010-10-15 18:30 ` Neal Kreitzinger
2010-10-15 18:43 ` Jonathan Nieder
2010-10-15 18:55 ` Jeff King
2010-10-15 19:32 ` Jonathan Nieder [this message]
2010-10-15 19:48 ` Jeff King
2010-10-15 18:57 ` Neal Kreitzinger
2010-10-15 19:02 ` Andreas Schwab
2010-10-15 23:22 ` Junio C Hamano
2010-10-15 23:40 ` Jonathan Nieder
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101015193252.GA23082@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=neal@rsss.com \
--cc=peff@peff.net \
/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.
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).