这是我到目前为止所做的。我要做的是在推送之前将第一次和第二次提交 merge 为一个提交(尚未添加远程存储库)。
$ git init
$ vim myprogram
$ git add myprogram && git commit -m "Initial commit"
$ vim README.md
$ git add README.md && git commit -m "Added readme"
$git log --pretty=oneline
b8e2979 Added readme
a579d65 Initial commit
$ git rebase -i HEAD~2
fatal: Needed a single revision
invalid upstream HEAD~2
我做错了什么导致了 fatal error 。
如果有人问过这个确切的问题,请标记它并提供链接。
最佳答案
您想使用 --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. ...
git rebase -i --root
关于Git rebase 首先 2 Commit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39071409/