Git Revert
Reverting a commit
If you want to go back to a different commit and stay there, you can do something else than using the checkout command. The commit you can use instead is git revert
. It works for only one commit, and before actually reverting, it will ask you for a revert message.
Revering a reverted commit
The commit where you added whatever you reverted is still there. If you ever feel like you might have made a mistake, you can revert what you reverted. That is probably a bit more complicated though.
When reverting a reverted commit, you should start from master. This is just to make sure you are working from the correct head state. After that, you can just run the command again and add another revert message.