git log - commit 리스트 간단하게 출력 (pretty)

git log 명령어로 commit list를 간단하게 출력하는 방법을 소개합니다.

1. 간략하게 commit 리스트 확인

git log BRANCH --pretty=format --no-merges --since=DATE FILE 명령어는 DATE부터 BRANCH브랜치의 FILE 파일에 적용된 commit들을 format에 맞게 간단히 보여줍니다.

아래와 같이 명령어를 입력하면 특정 날짜부터 반영된 commit 리스트들이 간단한 형식으로 출력됩니다.

$ git log HEAD --pretty=format:"%H | %cd | %s" --no-merges --since="2019-06-19"
0b843a077d5c526f9f981eed31a698a390baf675 | Sun Aug 23 16:59:05 2020 +0000 | Skip RAT type listener registration if IMSI is not available
0a9ff046af725329e096dc94778fd86f22eeb6dd | Fri Aug 21 16:33:26 2020 +0000 | Remove home snapshot immediately
0cb4db0f40cc607b2f6ef927ee3a11f8d467bd1d | Thu Aug 20 16:25:17 2020 +0000 | Refine system bar position restoring
3e817cab966035ab9b572e17bc9c2d75da007e99 | Thu Aug 20 16:25:13 2020 +0000 | [RESTRICT AUTOMERGE] Update the visibility of activities on sleeping display
117c0ca0e40b992f28d75b1d24bc2b893288c149 | Thu Aug 20 16:25:08 2020 +0000 | Correct the return value of applyAnimationLocked.
bc03ee7cddeb4ead5d4df6b1b645f01241971599 | Thu Aug 20 16:24:56 2020 +0000 | Update requested state after applying pending frames

특정 파일이나 폴더를 명령어에 인자로 전달하면, 지정된 파일의 commit들만 출력됩니다.

$ git log HEAD --pretty=format:"%H | %cd | %s" --no-merges --since="2019-06-19" services/Android.bp
abebc6a89729b79b0d3af45f27f27208df4d2c0f | Tue Jun 2 06:53:53 2020 +0000 | Switch to standard naming scheme
4eaac3afcc4fb3c7da923ec048e62f5c024bdc1d | Wed May 6 03:06:58 2020 +0000 | Fold service-jobscheduler and service-blobstore into services.jar
4d1d7b56cdb00e0f4706a585ab244db868c37f4e | Mon May 4 23:09:48 2020 +0000 | Add custom Error Prone check for SDK comparisons.
960c675a831092d221fdcb07c15cb2bfa3a0eeef | Sat May 2 18:03:21 2020 +0100 | Fix last-released check of removed.txt
48ee95e9b1d8c31a83065038f406ff9f2dc052e1 | Sat May 2 17:49:26 2020 +0100 | Change last-released filegroup
960c16cd389fd56542fd3dcc8935406e022cb1be | Wed Apr 22 20:59:21 2020 +0100 | Remove obsolete droidstub args
f9172bd785203c989363ae0e3837bfa3f912e5ef | Sat Mar 28 19:24:53 2020 +0000 | Export change id processor.

2. Pretty Format

위의 예제에서 --pretty=를 이용하여 특정 형식으로 로그를 출력하였는데요.

기본적인 pretty format들과 의미를 아래에 정리하였습니다.

  • %H : commit hash
  • %h : 축약된 commit hash
  • %an : author name
  • %ae : author email
  • %cd : committer date
  • %s : subject

pretty-formats 페이지에서 더 많은 format들을 확인할 수 있습니다.

관련 문서

Loading script...
codechachaCopyright ©2019 codechacha