Abstract: To reproduce the error
git branch -D <branch>
and git checkout -b <branch> --track origin/<branch>
git pull
you get ! [rejected] <branch> -> origin/<branch> (non-fast-forward)
to fix it, you have to delete the remote tracking information with git branch -d -r origin/<branch>
as well
OLD: Someone deleted the develop branch and created it to remove all feature branches and have the master as base again. Then he added some of the feature branches but not some others that made problems.
I did a git branch -D develop
and git checkout -b develop --track origin/develop
.
When i now try git pull
i get a ! [rejected] develop -> origin/develop (non-fast-forward)
a git remote show origin
shows
Local refs configured for 'git push':
develop pushes to develop (local out of date)
i can now do a git fetch origin develop
and git merge FETCH_HEAD
but then i have some conflicts and he wants to push a lot of things to develop. (maybe the old branch commits?) And with a git reset --hard
i'm back where the git pull shows the rejected message ..
How do i checkout the recreated branch best?
EDIT: even when i do git branch -D develop
i get with git pull
! [rejected] develop -> origin/develop (non-fast-forward)
and git remote show origin
said everything (up to date)
EDIT: i didn't recognized it at first, because the commit message was the same, but after a reset the HEAD is on a sha that the remote does not have, so still on the "old" branch ?
i had to delete the tracking branch as well
git branch -d -r origin/develop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With