Delete commits from a branch in Git

Careful: git reset –hard WILL DELETE YOUR WORKING DIRECTORY CHANGES. Be sure to stash any local changes you want to keep before running this command. Assuming you are sitting on that commit, then this command will wack it… The HEAD~1 means the commit before head. Or, you could look at the output of git log, … Read more

How to uncommit my last commit in Git [duplicate]

If you aren’t totally sure what you mean by “uncommit” and don’t know if you want to use git reset, please see “Revert to a previous Git commit”. If you’re trying to understand git reset better, please see “Can you explain what “git reset” does in plain English?”. If you know you want to use git reset, it still … Read more

How do I use ‘git reset –hard HEAD’ to revert to a previous commit? [duplicate]

First, it’s always worth noting that git reset –hard is a potentially dangerous command, since it throws away all your uncommitted changes. For safety, you should always check that the output of git status is clean (that is, empty) before using it. Initially you say the following: So I know that Git tracks changes I make to my application, … Read more