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