git-reset
Reset current HEAD to a specified state
TLDR
Unstage files
$ git reset [file]
Soft reset (keep changes staged)copy
$ git reset --soft [commit]
Mixed reset (unstage changes)copy
$ git reset [commit]
Hard reset (discard changes)copy
$ git reset --hard [commit]
Reset to upstreamcopy
$ git reset --hard @{u}
Unstage all filescopy
$ git reset HEAD
Reset single file to commitcopy
$ git reset [commit] -- [file]
copy
SYNOPSIS
git reset [options] [commit] [--] [files...]
DESCRIPTION
git reset moves the current HEAD to a specified state. It can unstage files, undo commits, or completely discard changes depending on the mode used.The three main modes are `--soft` (keeps changes staged), `--mixed` (unstages changes, the default), and `--hard` (discards all changes). When given file paths, it unstages those files without moving HEAD.
PARAMETERS
--soft
Keep changes staged.--mixed
Unstage changes (default).--hard
Discard all changes.--keep
Reset but keep local changes.--merge
Reset to merge state.-p, --patch
Interactive reset.
CAVEATS
Hard reset discards changes permanently. Be careful with --hard on uncommitted work.
SEE ALSO
git-checkout(1), git-revert(1)