2026-01-24

git status로 현재 상태 확인

작업 트리 상태를 확인하는 status 흐름을 정리합니다.

Rhio Kim

Rhio Kim

CEO

#git#status

Page reactions

Leave a quick reaction to this shorts.

반응을 불러오는 중...

!!steps

!duration 180.0

!

_10
# 작업 디렉토리와 스테이징 영역 비교
_10
$ git status
_10
On branch main
_10
Changes not staged for commit:
_10
(use "git add <file>..." to update what will be committed)
_10
(use "git restore <file>..." to discard changes in working directory)
_10
modified: example.txt
_10
_10
no changes added to commit (use "git add" and/or "git commit -a")

!!steps

!duration 180.0

!

_10
# 변경 사항을 스테이징한 후 상태 확인
_10
$ git add example.txt
_10
$ git status
_10
On branch main
_10
Changes to be committed:
_10
(use "git restore --staged <file>..." to unstage)
_10
modified: example.txt

!!steps

!duration 180.0

!

_10
# 변경 사항 커밋 후 최종 상태
_10
$ git commit -m "Update example"
_10
[main 3a8b7d2] Update example
_10
1 file changed, 1 insertion(+)
_10
_10
$ git status
_10
On branch main
_10
nothing to commit, working tree clean

!!steps

!duration 240.0

!

_10
# 추적되지 않은 새 파일이 있는 경우
_10
$ touch new_file.txt
_10
$ git status
_10
On branch main
_10
Untracked files:
_10
(use "git add <file>..." to include in what will be committed)
_10
new_file.txt
_10
_10
nothing added to commit but untracked files present (use "git add" to track)

!!steps

!duration 240.0

!

_12
# .gitignore 설정 후 상태 확인
_12
$ echo "temp/" > .gitignore
_12
$ mkdir temp
_12
$ touch temp/cache.log
_12
_12
$ git status
_12
On branch main
_12
Untracked files:
_12
(use "git add <file>..." to include in what will be committed)
_12
.gitignore
_12
_12
nothing added to commit but untracked files present (use "git add" to track)