git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git read-tree doesn't accept tree-ish

From
Elijah Newren <newren@gmail.com>
Date
Aug 23, 2021, 19:23 UTC
Message-ID
<CABPp-BHibnrJYAYe-uX_ib7DFR5kkd=G2Jh+nhANPkfbnoFOzw@mail.gmail.com>
In-Reply-To
<CAMJzOtz_h0iEL1VQCFvvLzw3XnL+qM=f+BvkmsTU=ps+0VA7RA@mail.gmail.com>
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>` ?
Previous: Nikita BobkoNext: Junio C Hamano
Message 5 of 7 in “git read-tree doesn't accept tree-ish”
  1. Nikita BobkoAug 23, 2021
  2. Elijah NewrenAug 23, 2021
  3. Jeff KingAug 23, 2021
  4. Nikita BobkoAug 23, 2021
  5. Elijah NewrenAug 23, 2021
  6. Junio C HamanoAug 23, 2021
  7. Nikita BobkoAug 23, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.