Search code examples
gitgit-branchgit-push

updated local but unable to push


i am unable to push but my local is already updated

git pull origin develop
already up-to-date

while pushing

 git push origin develop                  
 ! [rejected]        develop -> develop (non-fast-forward)
 error: failed to push some refs to 'xxxxxxx'
 hint: Updates were rejected because a pushed branch tip is behind its      remote
 hint: counterpart. Check out this branch and integrate the remote changes
 hint: (e.g. 'git pull ...') before pushing again.
 hint: See the 'Note about fast-forwards' in 'git push --help' for details.

What is going on ?

Added after edit :

git show-branch develop origin/develop :


 ! [develop] Merge branch 'develop' of XXXXX into develop
 ! [origin/develop] Merge branch 'develop' of XXXXX into feature/JavaSDK
 --
 - [origin/develop] Merge branch 'develop' of XXXXX into feature/JavaSDK
 + [origin/develop^2^2] [MPSC-2189]
 + [origin/develop^2^2^] [MPSC-2189]
 + [origin/develop^2^2~2] [MPSC-2189] location page 
 + [origin/develop^2~2] locations and service manager
 + [origin/develop^2^2~4] [MPSC-2189] edit location page
.....
 + [origin/develop~35^2^] [MPSC-2177]
-- [develop] Merge branch 'develop' of XXXXX into develop

Solution

  • Did you do some kind of history re-write (eg. : rebase, rename commit messages etc)?

    If yes, and if you are sure git log/gitk shows the correct commits, then you can do a forced push:

    git push -f origin develop