Re: [PATCH] update-index: add --swap to swap index and worktree content

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

 



Jeff King <peff@xxxxxxxx> writes:

>   # add some content with an error
>   echo 'printf("hello word!\n")' >hello.c
>   git add hello.c
>
>   # work on it more, realizing the error
>   echo 'printf("goodbye world!\n") >hello.c
>
>   # now what? you want to stage the s/word/world/ fixup,
>   # but you want to keep the hello/goodbye thing as a separate change.
>   # Using anything line-based is going to conflate the two.
>   # The change is simple, though, so you can just as easily edit the
>   # index file, if only you could get to it. So you do:
>   git update-index --swap hello.c
>   sed -i s/word/world/ hello.c
>   git update-index --swap hello.c
>
> So the swap really functions as a toggle of "I would like to work on
> the index version for a minute", and then you toggle back when you're
> done.

And you have to redo what you did to the index version in the working tree
after the second "swap", no?

--
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]