[Git] Status - 파일 상태 확인

노성빈·2024년 2월 9일

Git

목록 보기
3/15
post-thumbnail

📌Status - 파일 상태 확인


Status?


💡 작업 디렉토리(working directory)와 스테이징 영역(staging area)의 상태를 확인하기 위해서 사용한다.

status 정보 출력

git status

status 출력 내용

git status의 결과를 보면 크게 3개의 영역으로 구분이 되어 있는 것을 볼 수 있다.

$ git status
On branch search3
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   src/components/Control/Control.jsx
        modified:   src/components/Input/Input.jsx
        modified:   src/components/List/ListItem.jsx

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   src/components/Search/Search.jsx
        modified:   src/components/Search/Search.stories.jsx

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        src/components/Search/useSearch.js

Changes to be committed: staging area로 넘어가 있는 변경내용을 보여준다.

*Changes not staged for commit:* working directory에 있는 변경 내용을 보여준다.

Untracked files: working directory에 있으며, git이 관리한적 없는 새로운 파일을 보여준다.

staging area에서 특정 파일 제거

git reset HEAD <파일>

특정 파일의 변경 내용을 최신 커밋 내용으로 덮어 씌우기

git checkout -- <파일>

0개의 댓글