[Git] 깃 시작하기 - 2
변경사항 확인하기
- 수정된 파일 확인하기
git status
입력 하면 아래 메세지가 나온다.
On branch master
Your branch is up to date with 'origin/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: index.txt {: .notice--primary}
no changes added to commit (use "git add" and/or "git commit -a")
modified 부분을 살펴보면 index.txt 파일이 수정되었단 걸 알 수 있다.
- 변경된 내용 확인하기
git diff
입력 하면 아래 메세지가 나온다.
diff --git a/test.txt b/test.txt
index 33c53e5..30d74d2 100644
--- a/test.txt
+++ b/test.txt
@@ -1 +1 @@
-git diff 테스트
+test
\ No newline at end of file
test 파일에서 기존에 있던 git diff 테스트
라는 문구를 지우고 test
라는 문구를 추가한 걸 확인할 수 있다.
- 버전 만드는 단계마다 파일 상태 확인하기
tracked 파일과 untracked 파일
말 그대로 추적하고 있는 파일과 아닌 파일인데 깃은 한번이라도 커밋한 파일은 수정여부를 추적하고 있어 tracked 파일 이라고 하고
버전관리를 하지 않은 파일은 untracked 파일 이라고 한다.
커밋에 관련된 파일까지 확인하기
git log --stat
입력하면 지금까지 커밋한 내용과 무슨 파일이 변경되었는지 나온다.
2022-02-22 test
README.md | 3 ++-
_posts/2022-02-22-git_study_2.md | 0
2 files changed, 2 insertions(+), 1 deletion(-)
git add
README.md | 275 +-------------------------------------------------------------
1 file changed, 1 insertion(+), 274 deletions(-)
❗ 방금 커밋한 메세지 수정하기
git commit --amend
입력 후 vi 수정 하면 된다.
❗❗❗파일 상태 변화❗❗❗
untracked -> unmodified -> modified -> staged
-------------------스테이징-------------------->
--------파일수정---->
-----스테이징-->
<----------------커밋-----------
댓글