Git Revert with Exercise

Bryant Jimin Son
3 min readApr 8, 2023

Among different ways to undo our previous git commits, git revert is the safest way to do so. git revert does not actually overwrite the existing commit. Instead, git revert understands how to invert the changes introduced by the commit and appends a new commit with the inverted content. This operation is safe because it prevents git from losing git history.

Exercise — Git Revert

We will go through a simple exercise to try to out git revert. As long as you have Git CLI installed in your computer, you don’t need the internet connection.

NOTE: You can continue to use a same directory and a same script for other continuing exercises. However, the idea is to allow users to pick up from any step that they want to review later without depending on other steps. In addition, it is always easy to work with a clean slate. Because of this, you will see same or similar commands and instructions getting copied over multiple time.

STEP 1: Create a directory and cd into it

This will depend on your operating system.

  • Mac OS/Linux: Open up a Terminal window/shell window and make sure you are in a right directory (e.g. pwd).
  • Windows: Open up Git CLI by clicking on bottom left Windows button and search for Git CLI. Make sure…

--

--

Bryant Jimin Son
Bryant Jimin Son

Written by Bryant Jimin Son

A cloud practitioner talking about technology, travels & career tips. But I will sometimes cover financial advises and some random stuffs.

No responses yet