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

Re: [BUG] git restore: typo in error message "could not resolve ource"

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Dec 22, 2025, 11:56 UTC
Message-ID
<aUkx2XYCP75GrCsS@fruit.crustytoothpaste.net>
In-Reply-To
<CAMxgZ8KqU9BUJ6T7DLct3CaEh9EYdcMO=dBAMPyQsb=knekSuQ@mail.gmail.com>
On 2025-12-22 at 09:16:07, Zhelyo Zhelev wrote:
Show 8 quoted lines
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
> 
> What did you do before the bug happened? (Steps to reproduce your issue)
> I executed the following command in repository: git restore -source
> my_base_branch
> I have reproduced this on both Windows (git version 2.52.0.windows.1)
> and Ubuntu (git version 2.52.0).

I can also reproduce this using Git 2.51.0.338.gd7d06c2dae8 on Debian unstable.

Show 11 quoted lines
> What did you expect to happen? (Expected behavior)
> The error message should be:
> fatal: could not resolve source
> 
> What happened instead? (Actual behavior)
> The error message is:
> fatal: could not resolve ource
> 
> What's different between what you expected and what actually happened?
> There is a typo in the displayed error message - the first letter 's'
> is missing from the word "source" in the output.

I think this is due to a typo in your command and I'll explain why it happens.

You wrote `git restore -source`, not `git restore --source`. Most programs use double dashes for long options, including Git. Part of the reason the second dash is necessary is that `-source` is interpreted as `-s ource`, or the equivalent of `--source=ource`. Git was confused because `ource` didn't match any revision it could check out and obviously that's because you didn't intend that at all.

So I think this is functioning as designed and isn't actually a typo in Git. The code appears to be in `builtin/checkout.c`:

    builtin/checkout.c:                     die(_("could not resolve %s"), opts->from_treeish);

That shows that it prints "could not resolve" and then the thing it tried to resolve as a branch.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Previous: Zhelyo ZhelevNext: Junio C Hamano
Message 2 of 5 in “[BUG] git restore: typo in error message "could not resolve ource"”
  1. Zhelyo ZhelevDec 22, 2025
  2. brian m. carlsonDec 22, 2025
  3. Junio C HamanoDec 22, 2025
  4. checkout: quote invalid treeish in error messagebrian m. carlson, Dec 24, 2025
  5. Junio C HamanoDec 24, 2025

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.