fatal: Could not resolve HEAD to a revision

Viewed 942

I am trying to fetch my react-app run this:

git fetch origin

then run this:

git rebase origin/main

but got an error

$ git rebase origin/main
fatal: Could not resolve HEAD to a revision
1 Answers

Try first a git status, to understand where you are in your local repository.

For instance, if you have just created an empty repository, and added origin, you could not rebase your current non-existent local branch on top of origin/main.

Check the output of git branch -avv.
If you have a branch main, try and switch back to it.

git switch main

Then, and only then, try a simple git pull.

Related