If overriding of repository was done using one new commit, then it's better to revert it using command git revert <hash>
. With reverting will be created new commit and it will just revert changes made in commit <hash>
.
Using such approach you will still have wrong commit in your history, but if you don't have enough experience it is best way to fix such problem, just because it is easy, otherwise with approach like git reset --hard 0231c10
you will need to use push with force option and it's not very safe action and even if you are ready to go on this risk you need to know that you will need to ask all committers to do not very safe actions on their environment, like this git fetch origin
and then in master branch git reset --hard origin/master
.
But if you think you are ready for rewriting history in your repository then use git reset --hard 0231c10
as was proposed in another answer.