Re: How to create a new commit with the content of some commit?

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

 



On Wed, May 13, 2009 at 12:51 AM, Jeff King <peff@xxxxxxxx> wrote:
> On Wed, May 13, 2009 at 12:43:33AM +0800, Ping Yin wrote:
>
>> > You can just munge the index directly, and skip the working tree
>> > entirely:
>> >
>> >  rm .git/index
>> >  git read-tree b
>> >  git commit -m 'the copy of b'
>>
>> In a non-conflict status, "git read-tree b" will update the index to
>> full match the tree of b, so "rm .git/index" is unnecessary, right?
>
> For some reason, I was thinking that entries in the index that were not
> in "b" would remain, but that is not actually the case. So yes, I think
> you can do it without removing the index (and you are better off to do
> so, since the index also contains the stat cache for your worktree, so
> it is more efficient).
>
> You can also add "-u" as Junio suggested to update the working tree
> during that step, which should be more efficient.

I don't want to touch the working directory, and -m will keep the stat
cache in the index, so i think "git read-tree -m b" is the best.
--
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]