Undo last git commit

In the commit early and often strategy means checking in and commit code all the time like saving a file and sometimes when you do this you accidentally check in something that you shouldn't have and even push it up to the remote server(s)

Do this to fix it

  • Check the log first to see latest commit

git log --oneline -n 2

5a7d985 (HEAD -> main, origin/main, origin/HEAD) Merge branch 'main' of https://github.com/Siliconrob/ConceptTagHistory into main
00c9026 Change to do all customers
  • Move back one commit

git reset --hard HEAD~1

00c9026 (HEAD -> main) Change to do all customers
5209975 Removed dead project prettytable
  • Force the history to match

git push -f