Git duplicate commits

git

After streamlining the history of a Git branch using git rebase -i, I'm having some trouble with remotes:

$ git push remote-name branch-name
CONFLICT (add/add): Merge conflict in ...
error: failed to push some refs to 'ssh://...'
$ git pull remote-name branch-name
...
Automatic merge failed; fix conflicts and then commit the result.
$ git mergetool
$ git commit -m "Merge"

Now the history of the branch is messed up, with my commits appearing twice (parallel lines in gitk) after some seemingly arbitrary point before my first commit. I've tried git rebase -i, but now it complains that it "Could not apply 123abc…". How do I get rid of the parallel commits?

Best Answer

You did something wrong, but I'm having a hard time understanding what. One possibility is that you rebased something that you already pushed, and then tried to push it again. This is a big no-no, you should never rebase something that you've already pushed to a remote repo, or you'll run into various issues. Here's a short explanation of it

Related Question