git show 명령어로 commit 정보 확인

git show 명령어를 사용하여 commit 정보 및 변경 사항을 확인할 수 있습니다.

1. 특정 commit 정보 확인

git show <commit id>는 commit id의 정보 및 수정 내용을 보여줍니다.

$ git show 3cb225dc74b9f0faf0858fd4602ceaadb3e9d30c

commit 3cb225dc74b9f0faf0858fd4602ceaadb3e9d30c
Author: Peiyong Lin <lpy@google.com>
Date:   Mon Sep 28 23:17:37 2020 -0700

    [GraphicsEnvironment] Avoid null access.

    Currently when debug layer apk is not installed, GraphicsEnvironment
    logs the message and proceeds, which results in null pointer access
    crash when later trying to access primaryAbi. Avoid null access by an
    early return statement.

diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java
index df1f1b21eba..e77b163743f 100644
--- a/core/java/android/os/GraphicsEnvironment.java
...

commit id는 7자리까지만 입력해도 됩니다.

$ git show 3cb225d

commit 3cb225dc74b9f0faf0858fd4602ceaadb3e9d30c
Author: Peiyong Lin <lpy@google.com>
Date:   Mon Sep 28 23:17:37 2020 -0700
...

2. 최신 commit 정보 확인

git show는 가장 최신 commit의 정보를 출력합니다.

$ git show

commit 8c3b567c36ef56e03a67aac83fe045c4b239217e (HEAD -> master, origin/master, origin/HEAD)
Merge: 4f94f12cba2 f7dc3f6788d
Author: Nathan Harold <nharold@google.com>
Date:   Fri Dec 18 00:38:04 2020 +0000

    Merge "Fix permission on TM#isDataEnabled"

HEAD는 가장 최신 commit을 가리키기 때문에, 아래와 같이 입력해도 됩니다.

$ git show HEAD

commit 8c3b567c36ef56e03a67aac83fe045c4b239217e (HEAD -> master, origin/master, origin/HEAD)
Merge: 4f94f12cba2 f7dc3f6788d
Author: Nathan Harold <nharold@google.com>
Date:   Fri Dec 18 00:38:04 2020 +0000

    Merge "Fix permission on TM#isDataEnabled"

3. 최신 바로 이전 commit 정보 확인

HEAD^는 가장 최신 commit의 이전 commit을 가리킵니다. HEAD^^^은 최신 commit의 3개 전의 commit을 가리킵니다.

$ git show HEAD^

commit 4f94f12cba24c7d2c03447c742df5cf3a894307a
Merge: c0de8cfcfad 3fa9158be79
Author: Wonsik Kim <wonsik@google.com>
Date:   Fri Dec 18 00:09:34 2020 +0000

    Merge "MediaCodecInfo: do not alter performance points for 32-bit processes"

3.1 git show HEAD~1

HEAD~1HEAD^과 동일한 의미입니다. HEAD~3HEAD^^^과 동일한 의미가 됩니다.

$ git show HEAD^^^
commit 7c9eef5613cd6e9716dd608cbc08715c4f2ff19f
Merge: b8ff8f238e2 e92ddfef4ff
Author: Hui Wang <huiwang@google.com>
Date:   Thu Dec 17 22:53:31 2020 +0000

    Merge "RCS Provisioning APIs for Single Registration"


$ git show HEAD~3
commit 7c9eef5613cd6e9716dd608cbc08715c4f2ff19f
Merge: b8ff8f238e2 e92ddfef4ff
Author: Hui Wang <huiwang@google.com>
Date:   Thu Dec 17 22:53:31 2020 +0000

    Merge "RCS Provisioning APIs for Single Registration"

git log 명령어로 최신 커밋의 3개 전 commit이 맞는지 확인할 수 있습니다.

$ git log -4
commit 8c3b567c36ef56e03a67aac83fe045c4b239217e (HEAD -> master, origin/master, origin/HEAD)
Merge: 4f94f12cba2 f7dc3f6788d
Author: Nathan Harold <nharold@google.com>
Date:   Fri Dec 18 00:38:04 2020 +0000

    Merge "Fix permission on TM#isDataEnabled"

commit 4f94f12cba24c7d2c03447c742df5cf3a894307a
Merge: c0de8cfcfad 3fa9158be79
Author: Wonsik Kim <wonsik@google.com>
Date:   Fri Dec 18 00:09:34 2020 +0000

    Merge "MediaCodecInfo: do not alter performance points for 32-bit processes"

commit c0de8cfcfadf018828210a4d4d7ae939e0facd48
Merge: 7c9eef5613c 16624a11a8a
Author: Treehugger Robot <treehugger-gerrit@google.com>
Date:   Thu Dec 17 22:58:32 2020 +0000

    Merge "Use find-copy-subdir-files macro to eliminate foreach calls"

commit 7c9eef5613cd6e9716dd608cbc08715c4f2ff19f
Merge: b8ff8f238e2 e92ddfef4ff
Author: Hui Wang <huiwang@google.com>
Date:   Thu Dec 17 22:53:31 2020 +0000

    Merge "RCS Provisioning APIs for Single Registration"

관련 문서

Loading script...
codechachaCopyright ©2019 codechacha