Undo changes introduced by a bad commit

Report a typo

Everyone makes mistakes. Sometimes you accidentally commit changes that break your project. In this repository, there is a commit labeled "Bad commit" that modified file1.txt and file2.txt, making their contents incorrect.

Your task is to undo the effects of the "Bad commit" and restore the repository to the state of the previous commit ("Feature commit"). You may choose one of the following approaches:

  • Use git reset (with the appropriate option: --soft, --mixed, or --hard) to move the HEAD back one commit;

  • Use git revert to create a new commit that undoes the changes introduced by "Bad commit".

Write your Git command(s) below line by line.

Write a program
# Write your Git command(s) below line by line.

Create a free account to access the full topic