Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

github - git rebase fatal: Needed a single revision

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...