git rebase -i origin master“致命:需要一个单一的修订无效上游源”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31897929/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git rebase -i origin master "fatal: Needed a single revision invalid upstream origin"
提问by Erik ?sland
I am working on a Ruby project with a friend who has "collaborator" privileges in my Github.
我正在与一位在我的 Github 中拥有“合作者”特权的朋友一起从事 Ruby 项目。
- 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
.
- 他从他的分支(与 master 分开)发出了拉取请求。
- 我将他的拉取请求合并到主分支中。
- 然后我在命令行上发出命令
git rebase -i origin master
。
The git rebase -i origin master
command threw me the following error:
该git rebase -i origin master
命令向我抛出以下错误:
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.
关于这个错误还有其他问题,但没有一个完全符合这个问题的标准。
回答by blashser
The error is telling that git-rebase expects only one referente, not two. And origin is not a reference.
错误表明 git-rebase 只需要一个引用对象,而不是两个。起源不是参考。
You forgot the slash between origin and master.
你忘记了 origin 和 master 之间的斜线。
git rebase -i origin/master
- origin is the name of the repository.
- master is the branch of the repository.
- origin 是存储库的名称。
- master 是存储库的分支。
You can have several branches. Then the slash is telling git which branch of the repository is the one you want to rebase.
你可以有几个分支。然后斜线告诉 git 存储库的哪个分支是你想要变基的分支。
When you want to do a rebase of your own repository you only need to write the branch or reference without telling any repository.
当您想对自己的存储库进行 rebase 时,您只需要编写分支或引用,而无需告诉任何存储库。