I have some unpublished git commits in our current project. how to delete unpublished git commits and get rid of them permanently?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Priyanka Chakraborty
Note :Make sure these commits have not been pushed.
git reset –hard <commit hash number>
kushwanth
Yes, you can delete unpublished git commits:
To remove the last commit from git, you can simply run git reset –hard HEAD~1.
If you are removing multiple commits from the top, you can run git reset –hard HEAD~1 to remove the last two commits.