I am trying to do a rebase on the remote branch, but I get the following error:
$ git rebase -i origin/master~2 master
# fatal: invalid upstream 'origin/master~2'
I have tried to do a git fetch
and git pull
but it doesn't fix the problem.
In the git log
I can see the following:
$ git log
# commit 611e384e89da3cec1e45bf59d7564580912e5073 (HEAD -> master, origin/master)
# Author: Shahrad Elahi <[email protected]>
# Date: Sun Oct 30 14:38:57 2022 0330
#
# Initial Commit
#
# commit 8ae591b238960b862eb67bbb37377b5ca1611c47
# Author: Shahrad Elahi <[email protected]>
# Date: Sun Oct 30 14:34:50 2022 0330
#
# Initial Commit
CodePudding user response:
If you only have 2 commits, you cannot rebase onto the third-last. origin/master is 611e38; origin/master~1 is 8ae591; origin/master~2 does not exist. If you want to rebase all commits, including the root commit, use git rebase -i --root
.
CodePudding user response:
That's not gonna fly because origin/master~2
does not exist. Try git rebase -i --root master