First check the git log by running the command git log --oneline
Here you can see last six commit of this git repository.
add hello file
this commit for add the hello file
and after this commit last five commit i add five line
Now i want to revent the line 5
commit.
I add this line on 1009bb3 add line 5
commit.
here
1009bb3
- commit hash
add line 5
- commit message
so next step is run revert command git revert --no-commit <commit hash>
here our revert command is git revert --no-commit 1009bb3
After run the revert commit, line 6 is gone. now i have to commit the revert commit changes
here commit all the changes after run revert commit
now time to check git log. now here one new commit add Revert "add line 5"
Top comments (0)