Re: [RFC PATCH] Implement unstage and reset modes for git-add--interactive

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

 



Nanako Shiraishi <nanako3@xxxxxxxxxxx> writes:

> Quoting Junio C Hamano <gitster@xxxxxxxxx>
>
>> "resetting index entries selectively" makes perfect sense.  So do
>> "checking out index entries selectively" and "adding to index
>> selectively".
>
> Are you saying that you are fine with the concept of Thomas'es patch
> series but you don't want to see different words used to name these
> operations?

Essentially, yes.

Could you please wrap your lines to a reasonable length, by the way?

> In other words, do you mean the following would be a pair of better
> companions to "git add -p $file" than Thomas'es discard and unstage?
>
>  - "git checkout -p $file" and "git checkout -p $commit $file" that let
>  you view the patch to bring the file in the working tree to the version
>  in the index (or the commit) and selectively apply that to the working
>  tree and the index, to implement "discarding changes selectively".
>
>  - "git reset -p $file" and "git reset -p $commit $file" that let you
>  view the patch to bring the version of the file in the index to the
>  version in the HEAD (or the commit) and selectively apply that to the
>  index, to implement "undoing changes made to the index selectively".
>
> I think it preserves the UI consistency better to enhance checkout and
> reset than adding new commands to do conceptually the same
> thing...

I didn't read Thomas's series beyond the cover letter, but I'd say the
above three (counting "add -p" in the mix) extends the existing concepts
in a natural way:

 - "add" goes from work tree to the index;

 - "checkout" goes from commit or index to the work tree; and

 - "reset" goes from commit to index.

The "-p" variant (which exists to "add" but new to "checkout" and "reset")
allows you to do these movements in a finer grained manner than per
whole-file.

> ... Unfortunately I don't know how hard the necessary change will be,
> because these two commands are now implemented in C...

That's OK.  There are others on the list who groks C, like Thomas ;-)
--
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]