0

I messed up something in my commit history now I am not able to fix it in order to make the history straight as it was (there is no merging before and I would like to keep it that way).

commit history

I tried to rebase it or make git reset --soft HEAD on last commit and the last two merged commits again but I am always forced to pull the changes before pushing the merge commit and I am again running into same issue.Thanks a lot for any tips.

Petr Mensik
  • 26,874
  • 17
  • 90
  • 115
  • 1
    I am not sure, but try running `git rebase -i HEAD~2`. You shouldn't see the last message, so simply save and close the editor. Then you should have removed the last commit. `git push -f` and you should have done. But, I am not sure if then you will have the history "straight". – ThanksForAllTheFish Dec 04 '13 at 09:38

1 Answers1

2

It's not a fix, but my advice would be to leave it alone in case something goes wrong with master.

For a fix, however, you could also make a patch file for the complete changes that you want, force push an update to master in order to reset it back to an earlier commit, apply the patch to your local repository and then push to master again.

chooban
  • 9,018
  • 2
  • 20
  • 36