< Back to Posts

How to revert back to an old git commit


I ran into a situation when I wrongly pushed a couple of commits onto a remote repository.

Hence I need to remove those commits.

The commit "7f6d21" was about 6 commits back in my git log.

Force push that commit as the new master:

git push origin +7f6d21:master
                

Let's make something great together!

If you'd like to discuss your next project with us, please feel free to give us a call on 01827 781 311 or press the "Start My Project" button to get in touch for a quick quote.

Start My Project