Reverting commits to a previous version
Imagine yourself as a coder with a secret power: the ability to travel back in time within your projects. Your mission: to undo the mishap of the misnamed portfolio-section
by using the magical git revert
. It’s like having Ctrl + Z for your code on a grand scale, allowing you to reverse a mistake and restore to the point where everything was working great:
Figure 7.24 – git revert
Your recent adventure with git bisect
led you to the exact moment when the class name was changed incorrectly. Now, you decide to use git revert
to rewind history and correct this mistake.
Your detective work with git bisect
has paid off. You have the commit ID where everything was last perfect, right before the error was introduced.
In your terminal, the gateway to your time machine, type git
revert <SHA-of-bad-commit>
.
This command is like setting the coordinates in your time machine, pinpointing the exact...