Check out example codes for "git remove commits from branch after push". It will help you in understanding the concepts better.

Code Example 1

git reset --hard <last_working_commit_id>
So we must not reset to the commit_id that we don't want.

Then sure, we must push to remote branch:

git push --force

Learn ReactJs, React Native from akashmittal.com