: 깃에서는 버전을 만드는 각 단계마다, 파일 상태를 다르게 표시한다.

그래서, 파일의 상태를 이해하면 이 파일이 버전 관리의 여러 단계 중 어디에 있는지, 그 상태에서 어떤 일을 할 수 있는지 알 수 있다.

하지만, 파일의 상태가 눈에 보이는 것이 아니기 때문에, 머릿속으로 떠올려야한다.

tracked 파일과 untracked 파일

git status 를 사용하면, 화면에 파일 상태와 관련된 여러 메세지가 나타나는데, '작업 트리'에 있는 파일은 크게 tracked 파일과 untracked 파일로 나뉜다.

두 개의 파일은 무엇이 다를까?

  1. vim 을 활용하여, hello.txt 파일을 열고 원하는 문자를 추가하고 저장한다.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/4a3d8cdb-cc77-4f44-8665-bdcc271c3c7d/Untitled.png

  1. vim 을 활용해서 새로운 텍스트 hello2.txt를 만든다.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/84adedba-870b-4c7a-9e40-d4d4c677d6f9/Untitled.png

  1. hello.txt 와 hello2.txt 는 모두 '작업 트리'에 있는 상태이다. git status를 통해서 상태를 확인해보자.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/34774f23-6586-4a34-baf0-cc348d4c4bde/Untitled.png

  1. hello.txt와 hello2.txt를 스테이지에 올린다. (git add를 이용해서)

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0a027230-7bf4-4e0e-8200-456f596c6deb/Untitled.png