To keep the changes from the commit you want to undo
$ git reset --soft HEAD^
To destroy the changes from the commit you want to undo
$ git reset --hard HEAD^
You can also say
| # To use this, add .nvmrc with contents of 'N.N.N' to your project. e.g. 0.12.7 | |
| # Add the following to the end of .bash_profile or .bashrc | |
| # | |
| # if directory is changed | |
| # if `.nvmrc` is found execute `nvm use` | |
| # if `package.json` is round execute `nvm use default` | |
| enter_directory() { | |
| if [ "$PWD" != "$PREV_PWD" ]; then | |
| PREV_PWD="$PWD"; | |
| if [ -e ".nvmrc" ]; then |
| # Find last commit for the deleted file | |
| git rev-list -n 1 HEAD -- $path | |
| # Checkout the commit before the the delete happened | |
| git checkout $commit^ -- $path |
To keep the changes from the commit you want to undo
$ git reset --soft HEAD^
To destroy the changes from the commit you want to undo
$ git reset --hard HEAD^
You can also say