Log & Diff

๊ธฐ๋กํ™•์ธ(log)

log๋Š” ์—ญ์‚ฌ๋ผ ์ƒ๊ฐํ•˜๋ฉด ๋œ๋‹ค. commitํ–ˆ๋˜ ๋ฒ„์ „๋“ค์˜ ๊ธฐ๋ก์„ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ๋‹ค.

$ git log
commit c6ce442fa11b976aa717eeacd4dc05a501bfdda5
Author: dahye Jeong <wjdekgp1750@naver.com>
Date:   Thu Mar 23 17:28:55 2017 +0900

    first commit

    ์ฒซ ์ปค๋ฐ‹์ž„!!

commit ๋’ค์˜ ๋ฌธ์ž(c6ce442fa11b976aa717eeacd4dc05a501bfdda5)๋Š” ์ด ๋ฒ„์ „์— ๋Œ€ํ•œ ์‹๋ณ„์ž(hashcode)์ด๋‹ค.

$ git log -p
commit c6ce442fa11b976aa717eeacd4dc05a501bfdda5
Author: dahye Jeong <wjdekgp1750@naver.com>
Date:   Thu Mar 23 17:28:55 2017 +0900

    first commit

    ์ฒซ ์ปค๋ฐ‹์ž„!!

diff --git a/test1.html b/test1.html
new file mode 100644
index 0000000..58d93db
--- /dev/null
+++ b/test1.html
@@ -0,0 +1 @@
+<p>test</p>

์–ด๋– ํ•œ ์ฝ”๋“œ๊ฐ€ ๋ฐ”๊ผˆ๋Š”์ง€ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

๋น„๊ต(diff)

Unstage(uncommit)๋œ ์ˆ˜์ •์‚ฌํ•ญ ํ™•์ธ

$ git diff

commit(stage)๋œ ์ˆ˜์ •์‚ฌํ•ญ ํ™•์ธ

$ git diff --cached
$ git diff --staged

๋ธŒ๋žœ์น˜๊ฐ„ ๋น„๊ต

$ git diff [๋ธŒ๋žœ์น˜1] [๋ธŒ๋žœ์น˜2]
git diff master practice
diff --git a/aa.txt b/aa.txt
index ec18514..4374318 100644
--- a/aa.txt
+++ b/aa.txt
@@ -1,5 +1,3 @@
 first commit

-log,diff๋น„๊ตํ•ด๋ณด์ž!!
-
-master๋ธŒ๋žœ์น˜์•ผ
\ No newline at end of file
+log,diff๋น„๊ตํ•ด๋ณด์ž!!
\ No newline at end of file

commit๊ฐ„ ๋น„๊ต

$ git diff <commit hash> <commit hash>
$  git diff 59f62dfcb5742b3712f4e2a20c7e2b41e995fef9 cbba34b0b53696b22e8bf24894755431eaf2f525
diff --git a/aa.txt b/aa.txt
index ec18514..4374318 100644
--- a/aa.txt
+++ b/aa.txt
@@ -1,5 +1,3 @@
 first commit

-log,diff๋น„๊ตํ•ด๋ณด์ž!!
-
-master๋ธŒ๋žœ์น˜์•ผ
\ No newline at end of file
+log,diff๋น„๊ตํ•ด๋ณด์ž!!

๋งˆ์ง€๋ง‰ commit ๊ณผ ๊ทธ ์ „ commit ๋น„๊ต

$ git diff HEAD HEAD^

๋‹ฌ๋ผ์ง„ ๋ถ€๋ถ„์„ ์•Œ๋ ค์ค€๋‹ค.

Last updated