Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » Non-fast-forward reject caused loss (Not clear how to recover after a "commit and push" was rejected)
Non-fast-forward reject caused loss [message #1774421] Fri, 13 October 2017 21:22 Go to next message
Eclipse UserFriend
So I made a lot of changes to a Java project, used "Add to Index", and then "Commit and push". And got a "rejected non-fast-forward".

While google told me I need to do a fetch to recover, after a fetch the files were not seen as changed and were not offered for another commit.

So how do I recover from a non-fast-forward rejection and commit and push my changes?
Re: Non-fast-forward reject caused loss [message #1774457 is a reply to message #1774421] Sun, 15 October 2017 05:41 Go to previous messageGo to next message
Eclipse UserFriend
You need to rebase. Assuming your work should go onto the upstream master branch: rebase your local branch onto the upstream "origin/master" branch. If there are conflicts, resolve them, stage the files, then use "Rebase->Continue" to proceed with the rebase. Once you have successfully rebased your local branch, push again.
Re: Non-fast-forward reject caused loss [message #1774521 is a reply to message #1774457] Mon, 16 October 2017 15:18 Go to previous messageGo to next message
Eclipse UserFriend
The commits were created in your local git repository but push failed since the commits you tried to push were not a
successor of the current tip of the branch you pushed to. This typically happens if another developer pushed new commits
which you didn't yet download using fetch. If non-fast-forward push would be accepted the commits of the other developer
would appear to be lost (they would no longer be in the history of the branch you pushed to). Hence git rejects this.

So first fetch to download new commits which may have arrived on the server and then rebase your local branch onto the
remote tracking branch of the upstream branch you want to push to.
Re: Non-fast-forward reject caused loss [message #1774522 is a reply to message #1774521] Mon, 16 October 2017 15:20 Go to previous messageGo to next message
Eclipse UserFriend
Thanks! Is there some documentation somewhere about how to do a rebase? I tried but found the files so mangled that I had to restore from a local backup.
Re: Non-fast-forward reject caused loss [message #1774524 is a reply to message #1774522] Mon, 16 October 2017 15:23 Go to previous message
Eclipse UserFriend
that's described in the EGit user guide
https://wiki.eclipse.org/EGit/User_Guide#Rebasing
Previous Topic:Is it possible to use git merge.conflictstyle=diff3 in Eclipse?
Next Topic:Eclipse pull is causing dirty_worktree error
Goto Forum:
  


Current Time: Fri Sep 26 00:19:33 EDT 2025

Powered by FUDForum. Page generated in 0.04407 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top