[prev in list] [next in list] [prev in thread] [next in thread]
List: git
Subject: Re: Checkout file without changing index?
From: Sitaram Chamarty <sitaramc () gmail ! com>
Date: 2019-04-25 3:52:50
Message-ID: 005b0aed-2c20-0c91-e4ad-98b0ec39359d () gmail ! com
[Download RAW message or body]
On 24/04/2019 19.16, Junio C Hamano wrote:
> Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:
>
>> I was familiar with "git checkout revision -- file".
>>
>> But it updates both working tree and index. I had some changes in
>> index (staged) and "git checkout HEAD -- file" silently overwritten
>> it. Well, probably my mistake, it's documented.
>
> We'd invite you to live on the leading edge and try
>
> $ git restore --source=<revision> <pathspec>
>
> which by default checks things out only to the working tree, but not
> to the index (you say --staged if you want to restore to the index,
> and you say --worktree if you want to restore to the working tree,
> or you can say both, which would be the same as "git checkout").
>
> I think the new command is now on the 'pu' branch, but in a few
> weeks hopefully it will appear on the 'next' branch.
I'm not in a position to use either of those on at least some of my
systems, but meanwhile, I thought I'd ask this: what is the difference
between this and "git show REF:PATH > PATH", in terms of side-effects.
(I.e., any differences other than looking cleaner, not having to repeat
"PATH" etc.)
thanks
sitaram
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic