-1

I've just created a huge commit. Now I want to commit the reversal of these changes.

So basically I want to have the same files in my repo as I'll have after git reset --hard HEAD~1, but I'd like to keep the history of my changes, so create a new commit instead of removing the last one.

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
Daniel Stradowski
  • 3,466
  • 1
  • 12
  • 21

1 Answers1

-1

You can commit the reversal of one or more commits using git-revert. For instance, to revert the most recent commit:

git revert HEAD
Sam Estep
  • 12,974
  • 2
  • 37
  • 75
  • Whoever downvoted this, please leave a comment. The answer is perfectly correct. – AnoE Jun 22 '16 at 13:29
  • 1
    @AnoE I believe it's because the question is, arguably, a duplicate. – Sam Estep Jun 22 '16 at 13:30
  • Yes it's the duplicate, but other question's answer is tl;dr and was hard to find, but this guy solved my issue perfectly in few seconds after posting a question. Thank you! And please don't minus him more :D – Daniel Stradowski Jun 22 '16 at 13:45
  • @ferenus Thanks man. :) Also, for the record, although the answer in that other question does answer your question, the title implies a very important difference. Yours is very clear that you're specifically *not* asking for `git-reset` or similar, which is why I'm hesitant to call it a duplicate myself. – Sam Estep Jun 22 '16 at 13:54
  • Alright, the wonders of intermingling realtime answers/comments. :) – AnoE Jun 22 '16 at 14:12