Re: Can I checkout a single file without altering index?

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

 



Junio C Hamano wrote:

>                                                           If somebody
> can write a convincing use case that shows why it is useful, such an
> option shouldn't be very hard to add.  But I don't think of any.  For
> example, this is not it:
> 
>     I start from a clean slate and start working.
> 
>     $ git checkout
>     $ edit; git diff; compile; test; git add path ;# repeat
> 
>     At this point I have some cooked contents added for the next commit
>     in the index for path.  But I realize that the contents of that path
>     in another branch might be even better.  But I do not want to lose
>     the state I arrived at, which might be better than that alternative.
>     I cannot decide, so I'll keep that in the index for now.

To be a devil's advocate (because I am not convinced yet), here is one:

    I start from a clean slate and start working.

    $ git checkout
    $ edit; git diff; compile; test; git add path ;# repeat

    At this point I have some cooked contents added for the next commit
    in the index for path.  Illustrating the new change is a new test,
    and I want to "test the test" by trying it out against the inferior
    previous state.

    $ git checkout --no-index HEAD path
    $ test; edit test; git diff; compile; test; git add test ;# repeat

    Now one last test run with the improved state

    $ git checkout path
    $ compile; test
    $ git commit
--
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]