In this example, we'll learn how we can undo a commit as if it had never happened. We'll learn how we can use the reset command to effectively discard the commit and thereby reset our branch to the desired state.
Undo – Remove a commit completely
Getting ready
In this example, we'll use the example of the Git-Version-Control-Cookbook-Second-Edition_hello_world_cookbook repository, clone the repository, and change our working directory to the cloned one:
$ git clone https://github.com/PacktPublishing/Git-Version-Control-Cookbook-Second-
Edition_hello_world_cookbook.git
$ cd Git-Version-Control-Cookbook-Second-Edition_hello_world_cookbook.git