Getting push reject when trying to push to a remote branch
Asked Answered
G

2

6

After getting changes from a different branch using rebase, I'm trying to push the new changes to a remote private branch and I'm getting the following message

Push of the current branch XXXX was rejected. Remotes changes needs to be merged before pushing. In this case merge is highly recommended, because there are non pushed merge commits. Rebasing them can lead to problems.

Can you please explain more about this problem? If I'm using my own personal branch can I force push to it without a worry?

enter image description here

Garry answered 23/4, 2017 at 13:37 Comment(2)
It seems that branch you are pushing is not fast forward wrt destination one. So, you may run git push -f ... if you indeed want to rewrite it.Athapaskan
It sounds like your GitHub is configured to be non rebase-friendly. As the above comment says, you can do git push --force in this case. Note that if this branch is your own private one, then there is nothing wrong with doing a force push.Mantic
C
1

use git pull

git pull origin main
git push
Covering answered 22/5 at 16:22 Comment(0)
B
0
git rebase --abort
git pull origin development
git pull 
git push 
Brimful answered 20/5 at 8:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.