git-reset-file

Reset a single file to a specific revision

TLDR

Reset file to HEAD
$ git reset-file [file]
Reset file to a specific commit
$ git reset-file [file] [commit]

SYNOPSIS

git reset-file file [commit]

DESCRIPTION

git reset-file resets a single tracked file to its state at HEAD, or at a given commit if one is provided. Part of git-extras, it unstages the file and checks out its content from that revision, without touching the rest of the working tree or index.

INSTALL

sudo apt install git
sudo dnf install git
sudo pacman -S git
sudo apk add git
sudo zypper install git
brew install git
nix profile install nixpkgs#git

CAVEATS

The file argument comes first, followed by the optional commit; passing them in the wrong order silently fails since the second argument is treated as a commit-ish. The file must currently exist in the working tree.

SEE ALSO

git-reset(1), git-checkout(1), git-extras(1)

RESOURCES

Source code · Documentation