git rebase -i origin master "fatal: Needed a single revision invalid upstream origin"

18,497

The error is telling that git-rebase expects only one referente, not two. And origin is not a reference.

You forgot the slash between origin and master.

git rebase -i origin/master
  • origin is the name of the repository.
  • master is the branch of the repository.

You can have several branches. Then the slash is telling git which branch of the repository is the one you want to rebase.

When you want to do a rebase of your own repository you only need to write the branch or reference without telling any repository.

Share:
18,497
Erik Åsland
Author by

Erik Åsland

Updated on September 15, 2022

Comments

  • Erik Åsland
    Erik Åsland over 1 year

    I am working on a Ruby project with a friend who has "collaborator" privileges in my Github.

    • He issued a pull request from his branch (separate from the master).
    • I merged his pull request into the master branch.
    • I then issued the command on the command line git rebase -i origin master.

    The git rebase -i origin master command threw me the following error:

    devil@DEVil:~/repos/ruby_bank$ git rebase -i origin master
    fatal: Needed a single revision
    invalid upstream origin
    

    There are other questions on S.O. this error, but none of them quite meet the criteria of this problem.

  • Erik Åsland
    Erik Åsland over 8 years
    Hey. Thanks! This really helped. Could you explain to me why exactly the / is needed between origin/master ? What is it's purpose in this code? Thanks again!
  • blashser
    blashser over 8 years
    I edited the answer to explain better the reason of the slash. You are welcome ;-P