git/reset

Reset Changes

Reset current HEAD to the specified state

git
reset
changes

Command

git reset

Explanation

git reset is used to reset the current HEAD to the specified state. It resets the current HEAD to the specified state.

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