• 0

How to undo local changes in git

Lets say you have a couple of changes in your working directory that you want to discard. There are a few ways in which you can accomplish this.

1) Stash all your changes, then drop the stash

git stash
git stash drop

2) Do a hard reset from head. This moves data from the head to the stage as well as the working directory

git reset --hard HEAD