DEV Community

Hemant Govekar
Hemant Govekar

Posted on • Edited on

1

Git : Revert your mistake

Today we will understand how to revert any mistake we do when we checkin our code to git hub.
Video reference

We have below log in our github.

Alt Text
The above image has
1) The hash for latest code commit
2) commit message of latest commit
3) commit message of the code we need to revert to.

Issue:

We have commited (88e1246c30427b624c48dfb0012b27c55e8e6f1e) hash in github repository. This commit has some error and we need to revert the code back to commit (05f4be112f24cc1a9f0922f2c9a9297be429f55b)

Resolution:

1) git revert 88e1246c30427b624c48dfb0012b27c55e8e6f1e
This will revert the code base in your local system and NOT in git repository.

2) git push origin master
The above command is to upload the changes to git repository.

Advantage of this command is it helps to keep the log of the revert done as shown below.

Alt Text

Thanks for reading till here. if you like the article don't forget to subcribe my channel. My Channel Link

Video Link on Git :

GIT REVERT

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs