Reputation: 1721
I had a master
and made a branch A
. I committed the changes and pushed to github, went back to master
and created a branch B
did my things and pushed to github.
I went back to branch A
, made some changes and realised I needed the branch B
.
On branch A
I did git rebase B
and it was rebased without problems. I made some changes, rebased it with master and it all seemed fine.
However, now when I try to push to github I get the following message: Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. 'git pull ...') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details.
I can't figure it out, why is it behind now?
I tried git pull
but it didn't work. Should I do git pull origin A
?
Upvotes: 0
Views: 218
Reputation: 521093
When you rebased branch A
on branch B
, you rewrote the history of A
. As a result, Git is complaining when you push that it does not know how to apply the new commits on your local A
branch, because the base of that branch has changed. The usual way to resolve this is simply to force push A
to the remote via:
git push --force origin A
This will overwrite (read: clobber) the branch A
on the remote. But presumably this is what you want to happen.
Upvotes: 2