我正在尝试执行一个rebase on the remote branch,但是我得到了以下错误:
$ git rebase -i origin/master~2 master
# fatal: invalid upstream 'origin/master~2'
我尝试过做一个git fetch
和git pull
,但是它没有解决这个问题。
在git log
中,我可以看到以下内容:
$ git log
# commit 611e384e89da3cec1e45bf59d7564580912e5073 (HEAD -> master, origin/master)
# Author: Shahrad Elahi <shahradq@gmail.com>
# Date: Sun Oct 30 14:38:57 2022 +0330
#
# Initial Commit
#
# commit 8ae591b238960b862eb67bbb37377b5ca1611c47
# Author: Shahrad Elahi <shahradq@gmail.com>
# Date: Sun Oct 30 14:34:50 2022 +0330
#
# Initial Commit
发布于 2022-10-30 11:34:25
如果只有2次提交,则不能重定向到第三次-最后一次.起源/掌握为611 e38;起源/主~1为8ae591;起源/主~2不存在。如果要重基所有提交(包括根提交),请使用git rebase -i --root
。
发布于 2022-10-30 11:37:06
因为origin/master~2
不存在,所以它不会飞。试试git rebase -i --root master
https://stackoverflow.com/questions/74252607
复制相似问题