我正试图把几个提交一起浪费掉。当我使用
git rebase –i HEAD~8
我得到了致命的一击:
fatal: Needed a single revision
invalid upstream –i
以下是提交日志的一部分:git log
对应的Github存储库的所有提交历史记录都在这里:https://github.com/yikouniao/YukiLog/commits/master
Edit1:
当我使用git rebase –i HEAD~2
时,我得到了同样的结果。
Edit2:
我不知道我已经修改了文件.gitconfig
,editor = notepad2
被添加到了文件中。删除editor = notepad2
之后,一切都正常了。然后,我成功地更改了基数并浪费了8个提交。
发布于 2015-11-25 08:15:03
有几个选项:
Detached head
)上,或者您正在尝试rebase
或尝试访问错误的分支。签出您要rebase
的分支,然后重试。
git rebase -i --root
:
下面是关于--root
标志的文档,以及为什么它可以为您工作。
--root
Rebase all commits reachable from <branch>, instead of limiting them with
an <upstream>.This allows you to rebase the root commit(s) on a branch.
When used with --onto, it will skip changes already contained in `<newbase>`
(instead of `<upstream>`) whereas without --onto it will operate on every
change. When used together with both --onto and --preserve-merges, all root
commits will be rewritten to have `<newbase>` as parent instead.`
发布于 2018-01-12 02:37:28
问题出在-i中的破折号,它是一个短划线(U2013)而不是一个连字符(U002D)。我通过复制你的dash并在http://unicode.scarfboy.com上查找来确认这一点。改为-i。
线索是错误消息"invalid upstream -i“。Git没有将您的-i识别为标志,而是将其解释为上游参数。
https://stackoverflow.com/questions/33911379
复制相似问题