Egit rejected non-fast-forward

前端 未结 9 1766
夕颜
夕颜 2020-12-07 07:28

I am getting this message while pushing to github repository. Can you tell me step by step procedure to fix it? I pushed only once and it was successful. But, when I updat

相关标签:
9条回答
  • 2020-12-07 07:43

    In my case I chose the Force Update checkbox while pushing. It worked like a charm.

    0 讨论(0)
  • 2020-12-07 07:45

    Open git view :

    1- select your project and choose merge 2- Select remote tracking 3- click ok

    Git will merge the remote branch with local repository

    4- then push

    0 讨论(0)
  • 2020-12-07 07:45

    This error means that remote repository has had other commits and has paced ahead of your local branch.
    I try doing a git pull followed by a git push. If their are No conflicting changes, git pull gets the latest code to my local branch while keeping my changes intact.
    Then a git push pushes my changes to the master branch.

    0 讨论(0)
  • 2020-12-07 07:51

    Configure After pushing the code when you get a rejected message, click on configure and click Add spec as shown in this picture

    Drop down and click on the ref/heads/yourbranchname and click on Add Spec again

    Make sure you select the force update

    Finally save and push the code to the repo

    0 讨论(0)
  • 2020-12-07 07:53

    I have found that you must be on the latest commit of the git. So these are the steps to take: 1) make sure you have not been working on the same files, otherwise you will run into a DITY_WORK_TREE error. 2) pull the latest changes. 3) commit your updates.

    Hope this helps.

    0 讨论(0)
  • 2020-12-07 08:04

    Applicable for Eclipse Luna + Eclipse Git 3.6.1

    I,

    1. cloned git repository
    2. made some changes in source code
    3. staged changes from Git Staging View
    4. finally, commit and Push!

    And I faced this issue with EGit and here is how I fixed it..

    Yes, someone committed the changes before I commit my changes. So the changes are rejected. After this error, the changes gets actually committed to local repository. I did not want to just Pull the changes because I wanted to maintain linear history as pointed out in - In what cases could `git pull` be harmful?

    So, I executed following steps

    1. from Git Repository perspective, right click on the concerned Git
      project
    2. select Fetch from Upstream - it fetches remote updates (refs and objects) but no updates are made locally. for more info refer What is the difference between 'git pull' and 'git fetch'?
    3. select Rebase... - this open a popup, click on Preserve merges during rebase see why
      What exactly does git's "rebase --preserve-merges" do (and why?)
    4. click on Rebase button
    5. if there is/are a conflict(s), go to step 6 else step 11
    6. a Rebase Result popup would appear, just click on OK
    7. file comparator would open up, you need to modify left side file.
    8. once you are done with merging changes correctly, goto Git Staging view
    9. stage the changes. i.e. add to index
    10. on the same view, click on Rebase-> Continue. repeat 7 to 10 until all conflicts are resolved.
    11. from History view, select your commit row and select Push Commit
    12. select Rebase Commits of local....... checkbox and click next. refer why - Git: rebase onto development branch from upstream
    13. click on Finish

    Note: if you have multiple local repository commits, you need to squash them in one commit to avoid multiple merges.

    0 讨论(0)
提交回复
热议问题