Reputation: 1701
I have branch named X which I want to push to a remote master branch.
But when I execute:
git fetch remote_name
git checkout -B branchX remote_name/master
...
Add a commit
...
git push remote_name master
I get an error saying:
Updates were rejected because a pushed branch tip is behind its remote
counterpart. Check out this branch and integrate the remote changes...
If i check my branchX unique commit value, then I can see that the checkout was correct and there have been added a new commit, so for sure i am a head of remote_name master. And the remote master has NOT received any new commits in the meantime.
I normally use this procedure other places only difference here is that the branch names are not identical. What am i doing wrong?
Upvotes: 0
Views: 89
Reputation: 15369
You are trying to push your local repo's master
to your remote's master
. Your push command effectively expands to this:
git push remote_name refs/heads/master:refs/heads/remote_name/master
Obviously, that's not what you're trying to do. You need to explicitly specify which branches go where:
git push remote_name branchX:master
Upvotes: 3