How to revert commit in Git

Article autor
September 9, 2025
How to revert commit in Git
Elixir Newsletter
Join Elixir newsletter

Subscribe to receive Elixir news to your inbox every two weeks.

Oops! Something went wrong while submitting the form.
Elixir Newsletter
Expand your skills

Download free e-books, watch expert tech talks, and explore open-source projects. Everything you need to grow as a developer - completely free.

Table of contents

Did you ever create a commit that you wish never happened? Let's be honest - we all did. There is an easy way to revert it in Git.

It's as easy as performing git revert operation in console:

git revert [here comes the commit id]

Let's say, your commit id is 17hg8w. You would call it like this:

git revert 17hg8w

Note that this operation creates a new commit that reverts all of the changes instead of removing given commit from history.

Work with a team that keeps learning and building better software every day.

Related posts

Dive deeper into this topic with these related posts

No items found.

You might also like

Discover more content from this category

How to convert string to camel and snake case in Elixir

Sooner or later you may need to convert a string in Elixir to a camel or snake case. With Macro module (available in Elixir without extra dependency) it's super easy.

How to check if an Elixir map has a given key in a guard?

Today's Advent of Code puzzle inspired me to create this TIL. It may sound trivial, but in fact, it's tricky if you are unfamiliar with the nuances of guards' functioning.

Treating warnings as errors in Elixir's mix compile

Warnings in Elixir are usually an important sign of a problem in the codebase. There is an easy way to make them gone.