git rebase fatal: Needed a single revision

jrlmx2 picture jrlmx2 · Jan 25, 2011 · Viewed 226.1k times · Source

I have a branch of a public repository and I am trying to update my branch with the current commits from the original repository:

$ git fetch <remote>
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 20 (delta 12), reused 0 (delta 0)
Unpacking objects: 100% (20/20), done.
From git://github.com/path_to/repo
  9b70165..22127d0  master     -> $/master
$ git rebase <remote>
fatal: Needed a single revision
invalid upstream <remote>

The <remote> is in place of my remote name and is not actually my remote name. The documentation on this error seems to be a bit loose.

Answer

CB Bailey picture CB Bailey · Jan 25, 2011

You need to provide the name of a branch (or other commit identifier), not the name of a remote to git rebase.

E.g.:

git rebase origin/master

not:

git rebase origin

Note, although origin should resolve to the the ref origin/HEAD when used as an argument where a commit reference is required, it seems that not every repository gains such a reference so it may not (and in your case doesn't) work. It pays to be explicit.