git restore
are --source
or -s
, to specify what will be copied and
--staged
or --worktree
, to specify the destination. --staged
unstages a file that was added to the staging area: get restore --staged added-file.txt
rm foo.c git restore foo.c
git restore --source HEAD~42 foo.c
mkdir old-version git --work-tree ./old-version restore -s 9442d6c77c path/to/file.txt cd old-version/path/to ls file.txt
git show