0

I have committed to master and someone else has then committed after me.

I need to revert my commit but keep the commit that was made after me.

Can I just revert my commit with git revert commit-hash and the commit made after me will be OK?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
cdmt
  • 685
  • 4
  • 12
  • 23
  • Does this answer your question? [Why do I get conflicts when I do git revert?](https://stackoverflow.com/questions/46275070/why-do-i-get-conflicts-when-i-do-git-revert) – jonrsharpe Oct 21 '21 at 06:33
  • 1
    With `revert` you create a new commit on top of the other person's commit. Is that what you want? – j6t Oct 21 '21 at 07:54

1 Answers1

0

Yes, it should work, if you do not have any conflicts with the commits in front of the commit you are about to revert. With the reset command you would go back to your commit and delete all commits in front of yours

retoen
  • 379
  • 1
  • 7