link
git/reset

Reset Changes

Reset current HEAD to the specified state

git
reset
changes

Command

git reset

Examples

Undo last commit, keep changes

git reset HEAD~1

Undo last commit and discard changes

git reset --hard HEAD~1

Unstage file

git reset file.txt