Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I undo a previous commit in Github [duplicate]

So I've been working on this PR and it turns out that I need to revert a certain commit/push, note that I created multiple commits and pushes after that commit but I want everything to remain the same and only that commit to revert back, is that possible and how?

like image 385
Mohamed Eweidat Avatar asked Nov 21 '25 19:11

Mohamed Eweidat


1 Answers

you can use

git revert <commitID>

This effectively create a new commit that reverse the previous commit.

Remember to commit/push after that.

like image 134
Chan Jun Cheng Avatar answered Nov 24 '25 21:11

Chan Jun Cheng



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!