How do I undo the most recent local commits in Git?

Chamika Kasun
5 min readJun 1, 2021
Git

Recently accidentally committed the wrong files to Git, but didn’t push the commit to the server yet. Then I wanted to undo those commits from the local repository, So In this article, I’m going to share with you how to do that.

Steps to undo the most recent local commits

$ git reset HEAD~                              #

--

--

Versatile Full-stack Engineering Lead with 7+ years of experience designing, developing, and managing complex applications and internal frameworks.