oliverdavies.uk/source/_daily_emails/2024-05-22.md

976 B

title date permalink tags cta snippet
`git revert` is your friend 2024-05-22 daily/2024/05/22/git-revert-is-your-friend
software-development
git
~ `git revert` is your friend.

Imagine you've made a commit and want to undo it, or a particular commit is causing issues in production and you want to roll it back.

Instead of having to change it back manually, git revert can do it for you.

You specify the commit SHA you want to revert and Git will automatically try and revert that commit.

It creates its own commit message which includes the original commit message and the reverted commit SHA, so you can easily find or navigate to the original commit.

For example:

Revert "Sort talks only by the event date"

This reverts commit cbd1417b24a608df8b451a3ab5c9f888de41e758.

Next time, instead of manually reverting a commit, give git revert a try.