E D R , A S I H C RSS

GitForTheRealWorld (rev. 1.14)

Git For The Real World


1. Introduction

  • Git의 명령어를 아는 것보다 중요한 것은, 실제 상황에서 언제 어떤 상황에서 Git의 어떤 기능을 써야하는지 아는 것이다. 실제 활용 사례 및 방법을 연구할 필요가 있다.
  • 해당 페이지의 이름은 아래 블로그 포스트에서 따왔다.

2. rebase vs merge

3. commit log


3.1. commit log graph로 보기

console에서 commit log를 보다 보면 가끔 이 커밋의 부모가 누구인지 중요할때가 있다. 이런 경우 github나 기타 gui에서 보여주는 그래프 기능이 절실하게 필요해 질때가 있다. 사실 이 graph기능은 이미 있다.

$ git log --graph

이 명령의 문제는 한 커밋에 대한 메세지가 여러줄을 차지하기 떄문에 전체적인 그래프를 보기 힘들다는데에 있다. 이럴때에는 <del>oneline옵션을 사용하면 된다. 또한 브랜치 명이나 태그명을 보이게 하려면 </del>decorate옵션을 사용하면 된다. 색상이 밋밋하다면 --format옵션을 통해 나름의 포맷을 지정할수 있다. 이같은 옵션을 적용하여 만든 명령은 다음과 같다.


$ git  log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all

이를 매번 그래프 기능이 필요할때마다 넣는것은 매우 어려운 일이기 때문에 ~/.gitconfig파일에 다음과 같이 기록하여 별칭을 지정해 둘수 있다.

 
[alias]
    graph = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all

4. bisect

5. 항목 추가 바람


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:18
Processing time 0.0185 sec