Re: Checkout file without changing index?
- Date: Thu, 25 Apr 2019 13:02:44 +0900
- From: Junio C Hamano <gitster@xxxxxxxxx>
- Subject: Re: Checkout file without changing index?
Sitaram Chamarty <sitaramc@xxxxxxxxx> writes:
> 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.)
For that matter, what's the difference between these two and
git cat-file --filters REF:PATH >PATH
I think the major difference is that checkout and restore are facing
an end-user who is typing the command to the terminal interactively,
so it does not make it easy to deposit the contents to an arbitrary
path while taking pathspecs to allow multiple files to be checked
out. On the other hand, these "get content for a single path out of
the odb and then write it out to wherever I want to" may be more
suited for scripting.
Between the two that are for the-content-at-a-single-path, I would
further expect "git show REF:PATH" output would be less reliable
over time, as we reserve the right to add frills to the output from
the command to make it a more pleasant experience to humans (e.g. it
is not totally inconceivable for the command to notice "ah, this is
highligher), as opposed to placing more emphasis on the byte for
byte fidelity, which is desired for components used in scripts.
Those who would want the latter should be using the plumbing