简体   繁体   English

Git:致命的:即使提供了repo / revision,也需要进行一次修订

[英]Git: fatal: Needed a single revision even though repo/revision both supplied

I have added a remote "upstream" repo reference to a local clone: 我已将远程“上游”存储库引用添加到本地克隆:

git remote add upstream https://github.com/<owner>/<repo>

Then did a remote fetch 然后进行远程获取

git fetch upstream -a

Then the following attempt to rebase: 然后进行以下尝试以重新设置基准:

git rebase upstream/master

Gave us: 给我们:

fatal: Needed a single revision

We can see the upstream: 我们可以看到上游:

$git branch -r
upstream/master

Git status shows us on master: Git状态向我们显示了主人:

 $git status
 On branch master

 Initial commit

 nothing to commit (create/copy files and use "git add" to track)

What is needed here? 这里需要什么?

This git status output: git status输出:

$ git status
On branch master

Initial commit

nothing to commit (create/copy files and use "git add" to track)

indicates that this is a new repository with an "unborn master branch" - no commits have been made. 表示这是一个带有“未完成的主分支”的新存储库-未提交任何提交。

Because there are no commits on master to actually rebase, then git rebase should not be expected to work (there are several other caveats or other things that work differently in this "unborn branch" state, as well). 因为master上没有提交任何要实际变基的提交,所以git rebase不应起作用(在此“未出生的分支”状态下,还有其他一些警告或其他事情也有不同的工作)。

In this case, if your goal is for "master" to reference the same commit as "upstream/master", this is probably the best way to do that: 在这种情况下,如果您的目标是“ master”引用与“ upstream / master”相同的提交,则这可能是最好的方法:

git reset --hard upstream/master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM