Have you ever made changes that you regretted? Git relies heavily on its history, and you may feel that your latest commit only contributes to creating a big mess in it for the other developers of the project. If you already did a commit and now you want to delete it, don’t worry, there is a solution for that. You can remove the last commit from the git history with the command below:
$ git reset HEAD~
This will remove the last commit and the local files will be kept untouched. It was close, wasn’t it? Oh no! But what am I listening with these old ears? That you already made a push to the repository? There is a solution also for that. You must force the push of your local branch in the remote origin:
$ git push -f
Correct your course as soon as possible, buccaneer. The night sky is not always starry. Good winds!