Git
git
git
  • Introduction
  • Git
    • Basic
    • Remote Repository
    • Log & Diff
    • Rebase&Cherri-Pick
    • git-flow
Powered by GitBook
On this page
  • 기록확인(log)
  • 비교(diff)
  • Unstage(uncommit)된 수정사항 확인
  • commit(stage)된 수정사항 확인
  • 브랜치간 비교
  • commit간 비교
  • 마지막 commit 과 그 전 commit 비교

Was this helpful?

  1. Git

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^

달라진 부분을 알려준다.

PreviousRemote RepositoryNextRebase&Cherri-Pick

Last updated 5 years ago

Was this helpful?