--staged 옵션을 붙여 git restore 명령을 실행하면 준비 영역으로 보낸 파일을 다시 작업 디렉터리로 되돌립니다. 파일이 수정된 상태로 작업 디렉터리에 존재하고 있습니다. 이 상태에서 파일을 다시 수정하고 나서 git add 명령으로 준비 영역으로 보낼 수 있습니다.

    administrator@vmgate:~/gittest$ git restore --staged 2019AD.txt 
    administrator@vmgate:~/gittest$ 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:   2019AD.txt
    
    no changes added to commit (use "git add" and/or "git commit -a")

    파일 내용을 수정하기 전으로 되돌리려면 다시 git restore 명령을 실행합니다. 작업 디렉터리는 깨끗이 정리되었으며 파일 내용도 수정하기 전 상태로 돌아갔습니다.

    administrator@vmgate:~/gittest$ git restore 2019AD.txt 
    administrator@vmgate:~/gittest$ git status 
    On branch master
    nothing to commit, working tree clean
    administrator@vmgate:~/gittest$ cat 2019AD.txt 
    Why have dreams that cannot be?
    Why does this chaos kill me?
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.