Git 리포지토리 시각화

John Wachira 2022년8월23일
Git 리포지토리 시각화

이 기사에서는 리포지토리의 시각적 개체를 얻는 방법을 살펴보겠습니다. git log 명령을 사용하여 저장소의 지형을 확인합니다.

Git 리포지토리 시각화

Git을 사용하는 대부분의 개발자는 bash 터미널에서 대부분의 시간을 보냅니다. 쉬운 git log 명령은 모든 커밋을 나열합니다.

그러나 저장소의 멘탈 모델을 개발하는 것은 어려울 것입니다. 다른 사람이 귀하의 작업 흐름을 이해하기 어려울 수 있습니다.

다행히도 방법을 사용하여 리포지토리를 시각화할 수 있습니다. 이 내용은 곧 다룰 것입니다.

아래 예에서는 git log --oneline --all을 사용하여 저장소의 기록을 확인합니다.

pc@JOHN MINGW64 ~/Git (main)
$ git log --oneline --all
e923721 (refs/stash) WIP on main: 78129a6 Revert "$git status"
032ee0a index on main: 78129a6 Revert "git status"
78129a6 (HEAD -> main, New_Branch, Last_Branch, Branch1) Revert "$git status"
195e5c3 git status
7b19db4 first commit
b2f7710 (origin/main) Initial commit

위는 단순한 평면도입니다. 더 나은 보기를 위해 --graph 인수를 추가할 수 있습니다.

그러면 명령이 git log --oneline --all --graph를 읽어야 합니다.

예시:

pc@JOHN MINGW64 ~/Git (main)
$ git log --oneline --all --graph
*   e923721 (refs/stash) WIP on main: 78129a6 Revert "git status"
|\
| * 032ee0a index on main: 78129a6 Revert "git status"
|/
* 78129a6 (HEAD -> main, New_Branch, Last_Branch, Branch1) Revert "git status"
* 195e5c3 $git status
* 7b19db4 first commit
* b2f7710 (origin/main) Initial commit

더 좋아 보이지만 브랜치와 태그 레이블을 더 자세히 식별할 수 있습니다.

다음 컨텍스트에서 --decorate 인수를 사용합니다.

git log --oneline --all --graph --decorate

다음 컨텍스트에서 더 나은 레이아웃을 만들기 위해 --color 인수를 추가할 수도 있습니다.

git log --oneline --all --graph --decorate --color

저장소를 시각화하고 싶을 때마다 입력하는 것은 다소 긴 명령입니다. 아래와 같이 명령에 별칭을 할당하여 더 쉽게 만들 수 있습니다.

아래 예에서는 git log --oneline --all --graph --decorate --color 명령에 별칭 glt를 지정합니다.

pc@JOHN MINGW64 ~/Git (main)
$ alias glt='git log --oneline --decorate --graph --all'

별칭을 사용하여 명령을 실행해 보겠습니다.

pc@JOHN MINGW64 ~/Git (main)
$ alias glt
alias glt='git log --oneline --decorate --graph --all'

pc@JOHN MINGW64 ~/Git (main)
$ glt
*   e923721 (refs/stash) WIP on main: 78129a6 Revert "$git status"
|\
| * 032ee0a index on main: 78129a6 Revert "$git status"
|/
* 78129a6 (HEAD -> main, New_Branch, Last_Branch, Branch1) Revert "$git status"
* 195e5c3 $git status
* 7b19db4 first commit
* b2f7710 (origin/main) Initial commit
작가: John Wachira
John Wachira avatar John Wachira avatar

John is a Git and PowerShell geek. He uses his expertise in the version control system to help businesses manage their source code. According to him, Shell scripting is the number one choice for automating the management of systems.

LinkedIn

관련 문장 - Git Log