Closed yashinomi closed 4 years ago
変更を行う。
$ echo hogehoge >> hoge.txt
$ git add hoge.txt
$ cat hoge.txt
hogehoge
hoge
hogehoge
git add を取り消し。
$ git reset
Unstaged changes after reset:
M hoge.txt
$ git status
On branch master
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: hoge.txt
no changes added to commit (use "git add" and/or "git commit -a")
$ cat hoge.txt
hogehoge
hoge
hogehoge
git checkout hoge.txt
で戻した。
変更をなくさずに
git add
を取り消す