Re: Any way to edit the file in index directly?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]