반응형

커밋 메시지 모든 정보 보는 명령어

$ git log

 

위의 명령어는 너무 많은걸 보여준다.

내가 원하는 정보만 보는 방법은 없을까?

있다. 아래의 명령어를 참조하면 된다.

 

 

커밋 정보에 대해 조회하는 git log 명령어

// 출력 log 제한
$ git log -(n)

// 특정 날짜 이전/이후 commit만 조회합니다.
$ git log --since[after,until,before]

// 특정 저자/커미터의 commit만 조회합니다.
$ git log --author[committer]

// 특정 경로(폴더or파일)의 변경사항에 대해서만 조회.
$ git log --[path1] [path2] ...

 

파일 정보들 조회하는 git log 명령어

// 변경사항이 있는 파일 이름들을 조회 (full path)
$ git log --name-only

// 변경사항이 있는 파일 이름들과 상태 조회
$ git log --name-status

// 변경사항이 있는 파일들의 경로 이름 및 diffsat 조회
$ git log --stat
Author: gildong <gil@gmail.com>
Date : ~~

  message 3
  
  hello.txt   | 1+
  heelo2. txt | 4+++
  2 files changed, 5 insertions(+)

 

원하는 형식으로 조회

// 아래와 같은 형식으로 출력
$ git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
  ec36490 jesper  Wed Nov 26 05:41:37 2008 +0000  Cleanup after [942]: Using timezon

 

$ git log --pretty=format:"%h%x09%an%x09%ai%x09%s"

 

형식문자 참고하면 좋을 사이트 : https://git-scm.com/docs/pretty-formats

 

https://git-scm.com/book/ko/v2/Git%EC%9D%98-%EA%B8%B0%EC%B4%88-%EC%BB%A4%EB%B0%8B-%ED%9E%88%EC%8A%A4%ED%86%A0%EB%A6%AC-%EC%A1%B0%ED%9A%8C%ED%95%98%EA%B8%B0

 

 

참고

- jistol.github.io/vcs/2017/01/30/git-log/

 

- https://stackoverflow.com/questions/1441010/the-shortest-possible-output-from-git-log-containing-author-and-date

반응형