$ git init .
git 상태 확인
No commits yet: 버전이 없음
Untracked files: 추적되지 않고 있는 파일
$ vi hello.txt
$ git status
On branch main
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
hello.txt
nothing added to commit but untracked files present (use "git add" to track)
파일을 staging area에 지정한 파일을 올려놓기
파일을 버전으로 만들거라는 표시
Changes to be committed: 버전이 될 파일 목록
$ git add hello.txt
warning: in the working copy of 'hello.txt', LF will be replaced by CRLF the next time Git touches it
$ git status
On branch main
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: hello.txt
staging area의 파일들을 버전으로 만들기
working tree clean: 버전이 되지 않은 수정사항이 없음
nothing to commit: 버전으로 만들 파일이 없음
$ git commit -m "message 1"
[main (root-commit) 2eb09a5] message 1
1 file changed, 1 insertion(+)
create mode 100644 hello.txt
$ git status
On branch main
nothing to commit, working tree clean
$ git log
commit ~~~~~93e312 (HEAD -> main)
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:21:52 2025 +0900
message 1
$ vi hello.txt
$ git status
On branch main
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: hello.txt
no changes added to commit (use "git add" and/or "git commit -a")
$ git add hello.txt
warning: in the working copy of 'hello.txt', LF will be replaced by CRLF the next time Git touches it
$ git status
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: hello.txt
$ git commit -m "message 2"
[main 26eb89e] message 2
Committer: unknown <1111@~~~~~.com>
1 file changed, 1 insertion(+)
$ git status
On branch main
nothing to commit, working tree clean
$ git log
commit ~~~~~a4ec5 (HEAD -> main)
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:29:20 2025 +0900
message 2
commit ~~~~~e312
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:21:52 2025 +0900
message 1
$ vi hello.txt
$ vi hello2.txt
$ git status
On branch main
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: hello.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
hello2.txt
$ git add hello.txt
warning: in the working copy of 'hello.txt', LF will be replaced by CRLF the next time Git touches it
$ git add hello2.txt
warning: in the working copy of 'hello2.txt', LF will be replaced by CRLF the next time Git touches it
$ git status
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: hello.txt
new file: hello2.txt
$ git commit -m "message 3"
[main 69d4907] message 3
Committer: unknown <1111@~~~~~.com>
2 files changed, 2 insertions(+)
create mode 100644 hello2.txt
$ git status
On branch main
nothing to commit, working tree clean
$ git log
commit ~~8452 (HEAD -> main)
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:43:16 2025 +0900
message 3
commit ~~~ec5
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:29:20 2025 +0900
message 2
commit ~~~312
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:21:52 2025 +0900
message 1
$ git log --stat
commit ~~452 (HEAD -> main)
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:43:16 2025 +0900
message 3
hello.txt | 1 +
hello2.txt | 1 +
2 files changed, 2 insertions(+)
commit ~~ec5
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:29:20 2025 +0900
message 2
hello.txt | 1 +
1 file changed, 1 insertion(+)
commit ~~~e312
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:21:52 2025 +0900