If you have made changes that you don’t like, and they have not been committed yet, do as follows:
If you have one specific commit you want to undo, you can revert it as follows:
If you made a mistake on your last commit and have not pushed yet, you can undo it. For example, maybe you added some files and made a commit, and then immediately realized you forgot something. You can undo the commit, and then make a new (correct) commit. This will keep your history cleaner.