From: Nikita Bobko Date: Mon, 23 Aug 2021 19:10:33 GMT Subject: Re: git read-tree doesn't accept tree-ish Message-ID: In-Reply-To: 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. I was using `git read-tree :` 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 '/' overlaps with '/'. Cannot bind. ``` `git checkout -- ` also doesn't work in my case because if any file is removed in `` but not in my HEAD then `git checkout` doesn't remove the file in my HEAD On Mon, Aug 23, 2021 at 8:53 PM Jeff King wrote: > > On Mon, Aug 23, 2021 at 07:31:29PM +0200, Nikita Bobko wrote: > > > ``` > > git init > > echo foo > foo > > git add --all > > git commit -m 'foo' > > > > echo bar > foo > > git add --all > > git commit -m 'bar' > > > > git read-tree HEAD~:foo > > ``` > > EXP: Read information about file `foo` into index > > ACT: `fatal: failed to unpack tree object HEAD~:foo` > > > > I expect it to work because manpage says that `git-read-tree` accepts > > `` > > In your example, "foo" is a blob, not a tree. And thus HEAD~:foo > is not a tree-ish. Just "HEAD~" would be. > > What are you trying to do? > > -Peff