It sounds as if your dev branch was originally based on origin/master instead of origin/dev , or somehow dev was changed to track origin/master anyway. You can check this with:
git config branch.dev.merge
If refs/heads/master specified instead of refs/heads/dev , you can change the upstream branch for the dev branch with:
git checkout dev git branch --set-upstream dev origin/dev
Then, to fix your branch, I would:
- Make sure you are on
dev branch with git checkout dev - Make sure
git status clean. - Create a branch to save where you were (for security):
git branch dev-wrongly-rebased - Use
git reflog to find the commit before you reinstall it on origin/master - Reset
dev to this point git reset --hard COMMIT-BEFORE-BAD-REBASE - Finally do
git rebase origin/dev
My preference is when a reboot is always performed in two steps, for example:
git fetch origin git rebase origin/dev
... since I think it is less error prone than git pull --rebase . I hope this will be helpful.
source share