Senior
Is it possible to completely rollback the last commit?
sobes.tech AI
Answer from AI
Yes, the last commit can be completely rolled back using Git. If the commit has not yet been pushed to the remote repository, you can use the command:
git reset --hard HEAD~1
This will delete the last commit and revert the branch to the previous commit.
If the commit has already been pushed, it is better to use git revert to create a reverse commit, so as not to disrupt history:
git revert HEAD
This will create a new commit that undoes the changes of the last one.