Git fatal: ambiguous argument: unknown revision or path

Dung Do Tien Jun 24 2022 71

Hello you guys.

I have a C# project and push on Github source control.  This source has some developers working together. Today I created a new branch that is sprint20211109_fixbug_publish_verify_messages and based on from the main branch. 

But when I merge the main branch into this branch and have some commits added but I still do not push them.  

Now I want to revert/undo all those commits and don't want to push them to the origin of the current branch. I use the command:

 git reset --hard origin/sprint20211109_fixbug_publish_verify_message

But I got an exception fatal: ambiguous argument 'origin/sprint20211109_fixbug_publish_verify_messages': unknown revision or path not in the working tree.

 λ git reset --hard origin/sprint20211109_fixbug_publish_verify_messages
fatal: ambiguous argument 'origin/sprint20211109_fixbug_publish_verify_messages': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

I used Git version 2.35.1.windows.2.

Thank you in advance.

Have 1 answer(s) found.
  • B

    Ba Một Hai Jun 24 2022

    "Unknown revision or path not in the working tree." Sometimes I got this error because that branch name has not existed.

    Please be sure that the sprint20211109_fixbug_publish_verify_message branch is existed in your Github repo.  I think you missed s character at the end of the branch. 

    It should be sprint20211109_fixbug_publish_verify_messages not sprint20211109_fixbug_publish_verify_message.

    Please check again.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close