EN
Git reset 1 commit / revert last commit
1 answers
2 points
How can I reset 1 commit back with Git?
I don't want to keep anything eg any local files not commited etc, I just want to roll back 1 commit.
Nothing else, nothing more.
Thanks for the answer.
1 answer
2 points
Quick solution:
xxxxxxxxxx
1
git reset --hard HEAD~1
Practical example:
Take a look at this screenshot, flow:
git log
show us 2 commits- We execute:
git reset --hard HEAD~1
git log
show us 1 commit, because we removed 1 commit
People somethimes call git reset:
- rollback 1 commit
- revert 1 commit
- remove 1 commit from git history
-
undo last commit
:)
0 commentsShow commentsAdd comment