Everyone can make a mistake and Git is probably one of the easiest technologies ever where mistakes happen. Sometimes you or other developers commit things that weren’t supposed to be committed or even push them on the remote repository. Usually, once something is pushed you don’t want to mess up with the commit history, but under some circumstances this is totally acceptable. When this happens, you might need a guide to know exactly what to do.
This article will teach you how to undo and fix many common mistakes when working with Git:
https://github.com/blog/2019-how-to-undo-almost-anything-with-git
Trick of the day: Undoing mistakes in Git