add
한 것을 취소하는 방법이 궁금했다. add 한 후 'Ctrl + z'를 하는git add
명령어로 add(스테이징)된 파일을 다시 unstaged 상태로 되돌리려면 restore와 reset 명령어를 사용할 수 있었다. 그 차이와 활용에 대해서 정리하고자 한다.git restore --staged <파일명>
git add myfile.txt
를 실행한 후, 스테이징을 취소하려면 아래와 같이 입력한다.git restore --staged myfile.txt
git restore --staged .
git reset
) 사용git restore
대신 git reset
명령어를 사용할 수도 있다.
특정 파일:
git reset <파일명>
모든 파일:
git reset
git restore <파일명>
을 사용해야 한다.