eclipsegitegit

getting rejected non fast forward issue in egit


I have done checkout from branch 2.0 .

Now I made changes to one of the file.
I want to commit it to branch i.e 2.0 branch,
So I right click on file , select team->commit option I ask me to select branch .

So I selected 2.0 and repository url. When I click , commit & push , on next box ,it is giving me confirmation box with expected push result as 2.0 [rejected-non-fast-forward].

Is it because of I am in develop group not in master ?
Also I able to changes on my local commit, but it is not reflected in master copy so is their any way to commit it to master copy.

Attached screenshot of confirm box.

enter image description here


Solution

  • Yep.

    You try to push code from branch different to master and you cant.

    How to fix it?

    # commit all your changes to the desired branch (develop is i understand you correctly)
    
    # checkout the master branch
    git checkout master
    
    # merge the changes from develop into master
    git merge develop
    
    # now push the changes
    git push origin master.
    

    The git merge created a new merge commit and now you can push it back to master.