Git

Git: git restore --staged <file> — Linux

Unstage a file without changing its working copy.

Availability: Tool and version dependent; install separately where required.中文

Syntax

git restore --staged <file>

Examples

Unstage a file without changing its working copy.

git restore --staged <file>

Parameters, options and clauses

Option / clauseDescription
--stagedRestore the index, removing the selected path from the staging area.
--source <tree>Choose the source tree or commit.
--worktreeRestore the working-tree file as well.
-- <path>Separate options from the path list.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory