food.txt 파일에 이제 직접 내용을 써보자.
그전에 git 과 vscode을 연동해서 사용하면 편리하기 때문에
vscode에서 command+shift+p 를 눌러서
제일 위에있는 셸명령 code 을 설치한다.
그럼 터미널에 code . (뛰어쓰기 된 점) 을 누르면 바로 vscode 창이 뜬다.
1. 파일 수정하기 make a changes
git status
On branch master
nothing to commit, working tree clean
git status
On branch master
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: food.txt (빨간색으로 표시 unmodified라는 뜻)
no changes added to commit (use "git add" and/or "git commit -a")
위에서 working tree에 있으면서 Unmodified - save changes 상황이다.
2. 파일 staged에 올리기 : git add filename.filetype
git add food.txt
git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: food.txt
3. 파일 commit 하기 : git commit -m "commit message"
git commit -m "add type of 김밥"
[master 10e5d5b] add type of 김밥
1 file changed, 2 insertions(+)
git status
On branch master
nothing to commit, working tree clean
commit 후에 working tree은 비워진다.
4. commit 기록보기 : git log
git log
commit 10e5d5b8b2a13560796bc032cb5e5ed9bfdc5a64 (HEAD -> master)
Author:
Date: Wed Apr 27 13:58:46 2022 +0900
add type of 김밥
commit cfe32de762d1384aac61116f27fd79de9725a31a
Author:
Date: Wed Apr 27 13:42:42 2022 +0900
create a food file
'TIL > Git & Github' 카테고리의 다른 글
[TIL][Git][CLI] GIT으로 뭘할건데? - 4. merge 합치기! 삼단변신! (0) | 2022.04.27 |
---|---|
[TIL][Git][CLI] GIT으로 뭘할건데? - 3. 새로운 Branch 에서 커밋하기 (0) | 2022.04.27 |
[TIL][Git][CLI] GIT으로 뭘할건데? - 2. 커밋하기 ( Commits) 파일만들기 (0) | 2022.04.27 |
[TIL][Git][CLI] GIT으로 뭘할건데? - 1. 저장소 만들기(Make a Repository) (0) | 2022.04.27 |
[TIL][Git] GIT 을 어떻게 쓰는 건데? (0) | 2022.04.27 |