git restoreコマンドでステージングを取り消してワークツリーを元に戻す方法
git restoreコマンドでステージングを取り消してワークツリーを元に戻すには-Wオプションと-Sオプションを指定します。
オプションの説明
-W, --worktree, -S, --staged Specify the restore location. If neither option is specified, by default the working tree is restored. Specifying --staged will only restore the index. Specifying both restores both.
-Wオプションと-Sオプションを指定した場合
$ git status On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: test.txt Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: test.txt $ git restore -W -S test.txt $ git status On branch master nothing to commit, working tree clean
-Wオプションと-Sオプションを指定しない場合(デフォルトはワーキングツリーの変更取り消し)
$ git status On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: test.txt Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: test.txt $ git restore test.txt $ git status On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: test.txt

Git:git restoreコマンドでステージングを取り消す方法
gitrestoreコマンドでステージングを取り消す方法gitrestoreコマンドでステージングを取り消すには-Sオプションを指定します。オプションの説明-W,--worktree,-S,--stagedSpecifytherestore...