From: Jeff King <peff@peff.net>
To: Ping Yin <pkufranky@gmail.com>
Cc: git mailing list <git@vger.kernel.org>
Subject: Re: Any way to edit the file in index directly?
Date: Tue, 7 Apr 2009 22:10:41 -0400 [thread overview]
Message-ID: <20090408021041.GB18244@coredump.intra.peff.net> (raw)
In-Reply-To: <46dff0320904071803k68fddff4j226760392e0c5bcc@mail.gmail.com>
On Wed, Apr 08, 2009 at 09:03:03AM +0800, Ping Yin wrote:
> There seems to be a patch for this ( add -e?), but i forget where to
> find it.
"add -p" has an "e"dit option for editing the patch. I don't recall any
way of directly editing the content.
> For a big change, instead of "add -p", it may be easier to edit the
> index directly ( with the corresponding worktree file alongside)
I'm not sure what you mean by "alongside". If you mean "by editing a
temporary file that corresponds to the index file without munging your
worktree file", then you can do:
FILE=foo.c
git show :$FILE >$FILE.tmp
$EDITOR $FILE.tmp
object=`git hash-object -w $FILE.tmp`
git update-index --cacheinfo 100644 $object $FILE
And obviously you could make a script for that if you wanted (but at the
very least, you would need quotes to handle files with spaces, and
probably some magic to handle smudge/clean filters and CRLF properly for
the tempfile).
-Peff
next prev parent reply other threads:[~2009-04-08 2:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-08 1:03 Any way to edit the file in index directly? Ping Yin
2009-04-08 2:10 ` Jeff King [this message]
2009-04-08 2:16 ` Jeff King
2009-04-08 2:27 ` Ping Yin
2009-04-08 5:44 ` Markus Heidelberg
2009-04-08 2:39 ` Johannes Schindelin
2009-04-08 4:17 ` Ping Yin
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=20090408021041.GB18244@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=pkufranky@gmail.com \
/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).