Git/Git: 명령어 정리
[Git:명령어 정리] diff 명령어 정리
데브마우스
2024. 1. 9. 17:51
git diff 명령을 사용하면 스테이지의 파일과 저장소에 있는 최신 커밋을 비교할 수 있습니다.
git diff 형식은 다음과 같습니다.
git diff [<options>] [<commit>] [--] [<path>…]
git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>…]
git diff [<options>] [--merge-base] <commit> [<commit>…] <commit> [--] [<path>…]
git diff [<options>] <commit>…<commit> [--] [<path>…]
git diff [<options>] <blob> <blob>
git diff [<options>] --no-index [--] <path> <path>
최신 커밋 기준 test.txt에 test만 작성되어 있었습니다.
text.txt에 2를 다음 줄에 추가하여 작성하였습니다.
git diff
diff --git a/test.txt b/test.txt
index 30d74d2..02acdd2 100644
--- a/test.txt
+++ b/test.txt
@@ -1 +1,2 @@
-test
\ No newline at end of file
+test
+2
\ No newline at end of file