Why "git push" is rejected? ("git pull" doesn't help)

My current branch is my_branch.

That is your problem. When you pull, Git is telling you that your branch my_branch is up to date, not master, which is behind origin/master making a fast-forward merge impossible.

In order to push master, you need to check out master and pull. This will merge in the changes waiting on origin/master and allow you to push your own changes.

git checkout master
git pull
# resolve conflicts, if any
git push

[If your master branch is already configured to rebase on pull, then you just need to do a pull on the master branch as is described in other answerd, but otherwise:]

If you get a non-fast-forward message, this means you can only push commits on top of the existing commits, but you're trying to do otherwise. Do a rebase on master before pushing (assuming the remote is called origin):

git checkout master
git pull --rebase origin master
git push

See also this question: git rebase and git push: non-fast forward, why use?


change developer permission to "Maintainer"

Tags:

Git

Git Push