
log : commit history 살펴보기
git log 는 git 으로 관리되는 프로젝트의 commit history 를 보여주는 명령어.
누가 언제 어떻게 프로젝트에 변경이 이루어졌는지, 브랜치간의 관계, commit id 등을 확인할 수 있음.
기본 사용
git log
- 현재의 branch의 commit history를 시간의 역순으로 출력해줌.
- 각 commit 에는 author, date, commit message, commit id (SHA1 hash value)를 보여줌.
2024.05.21 - [분류 전체보기] - [CE] Hash Algorithm: SHA1 은 Secure Hash Algorithm 1의 약자로 Hash function의 하나임.
[CE] Hash Algorithm
Hash란?Hash 는 임의의 크기를 가진 데이터를 고정된 크기의 (고유한) 데이터로 변환하는 방법 임.이 변환 과정은 Hash Algorithm에 의해 명확하게 정의됨.Hash Algorithm을 통해 생성된 해시 값(Hash, Hash Valu
ds31x.tistory.com
git log <branch_name>
<branch_name>을 보여줌.
주요 Options
--branches:- 모든 local 브랜치의 commit history를 출력
- remote branch까지 포함하려면 --all 을 사용해야 함.
--oneline:- 각 commit 들을 한 line으로 출력.
-n <int>:- commit history 에서 출력할 commit 의 수를 지정
- 숫자로 지정.
--stat:- 각 commit에서 변경된 파일과 추가 및 삭제된 line 수를 출력.
- statistics 를 출력.
--graph:- branches 의 merge 등의 관계를 ascii graph 로 출력.
특정 범위의 commit history 출력 또는 branch 간의 차이를 출력
여러 commits를 지정하는 범위 지정 방식은 git사용시 자주 나오니 꼭 기억하길 권함.
git log <기준_branch>..<대상_branch>
<기준_branch>와<대상_branch>의 차이점을 출력해줌.- 기준_branch 에는 없고, 대상_branch 에는 있는 commit 을 출력.
git log <시작_commit>..<끝_commit>
시작_commit부터끝_commit사이의 commit history 출력 (현재 branch에서)git log HEAD~4..HEAD: 현재 branch의 최신 commit 의 4번째 전 commit (HEAD~4) 이후부터 최신 commit (HEAD) 까지의 commit history 출력.- HEAD~4 등의 Relative Reference에 대한 이해가 없다면 "같이 읽어보면 좋은 자료들"에서 관련 URL을 꼭 확인할 것.
범위를 나타내는 .. 를 사용할 때,
시작하는 위치 이후 부터 (exclusive)
끝나는 위치까지임 (inclusive)
(시작 commit id등은 exclusive임)
같이 읽어보면 좋은 자료들
2025.07.24 - [utils/git and github] - Relative Reference-Git-caret and tilde + Reflog Reference
Relative Reference-Git-caret and tilde + Reflog Reference
Git에서 commit을 가리킬 때 Absolute reference와 Relative reference, Reflog Reference 의 세가지 방식이 있음.Absolute reference: commit id를 사용함.Relative reference: tilde(~)와 caret(^)Reflog reference: at(@) 을 사용함.SHA1 으로
ds31x.tistory.com
[Git] Git Summary (작성중) (tistory.com)
[Git] Git Summary (작성중)
git이란2024.05.20 - [utils/git and github] - Git : 소개 git 설치 후 해줘야 하는 작업들[Git] git 설치 후 우선 해줘야 하는 작업들 (tistory.com)local repository 초기화2024.05.20 - [utils/git and github] - [Git] init : local repo
ds31x.tistory.com
'utils > git and github' 카테고리의 다른 글
| [Git] tag: 특정 commit 을 가리키는 별명. (1) | 2024.01.01 |
|---|---|
| git restore: commit 이전의 변경사항 취소하기. (1) | 2024.01.01 |
| [git] switch : branch 전환 (0) | 2023.12.31 |
| [git] stash : 현재 작업을 임시 저장 (1) | 2023.12.31 |
| [git] branch : branch를 생성하거나 확인 또는 삭제 및 변경 (0) | 2023.12.30 |