undo changes since last commit code example
Example 1: undo last commit but keep changes
git reset @~
Example 2: how to abandon changes and go last commit
#ignore all changes, and back to last commit
git add .
git stash
git reset @~
#ignore all changes, and back to last commit
git add .
git stash