git reset -- <pathname>
Unstage changes to a specific file or files
The command works by moving files from the staging area back to the working directory, effectively 'unstaging' them.
By specifying a pathname
, you tell git which files you want to unstage.
When no pathname
is given, git reset --
will unstage all files. git reset -p
allows to interactively choose patches.
The commands git reset --soft
, git reset --mixed
, and git reset --hard
provide more options on resetting the HEAD
, the staging area, and the working directory respectively.
Specific examples:
git reset -- README.md