Re: git read-tree doesn't accept tree-ish
Hi,
On Mon, Aug 23, 2021 at 12:09 PM Nikita Bobko <nikitabobko@gmail.com> wrote:
Show 6 quoted lines
>
> Yes, now I see. Thanks!
>
> I was trying to read state of a particular directory/file from a
> particular revision into my index but so far didn't manage to do it
> reliably.
Please don't top-post on this list.
Show 11 quoted lines
> I was using `git read-tree <hash>:<path>` and it doesn't work for
> files (because they are blobs not tree-ish as you elaborated it to me)
> and for directories, in my cases, it fails with not so helpful
> message:
> ```
> error: Entry '<path>/<subpath>' overlaps with '<path>/<subpath>'. Cannot bind.
> ```
>
> `git checkout <hash> -- <path>` also doesn't work in my case because
> if any file is removed in `<hash>` but not in my HEAD then `git
> checkout` doesn't remove the file in my HEAD
Have you tried `git restore --source=<hash> -- <path>` ?