Git/Theory

Configure

병홍 2013. 5. 6. 20:11

Configure

 

 

Git은 /etc/gitconfig 파일을 우선 적용하고 ~/.gitconfig 파일을 찾아서 적용

git config --system

/etc/gitconfig

git config --global

~/.gitconfig

 

git config --global core.editor emacs

Emacs로 편집기 실행

 

Commit message 설정

.gitmessage.txt 파일 생성 (원하는 commit message)

git config --global commit.template .gitmessage.txt

git commit

 

git config --global user.signingkey <gpg-key-id>

git tag -s <tag-name>

GPG 키를 설정해두어 Tag 만들 때 키를  하지 않아도 서명됨

 

git config --global color.ui true

컬러로 Terminal이 보여짐

true 또는 always 등으로 사용 가능

 

Merge Tool 변경

1. 스크립트 생성

vi extMerge  스크립트

 

#!/bin/sh

/Merge Tool 경로  $* 

path old-file old-hes old -mode new-file new-hex new-mode 중에 old-file과 new-file만 사용할 스크립트

 

vi extDiff 스크립트

#!/bin/sh

[ $# -eq 7 ] && /extMerge "$2" "$5"

 

sudo chmod +x  extMerge

sudo chmod +x  extDiff

 

git config --global merge.tool extMerge

git config --global mergetool.extMerge.cmd  'extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED" '

git config --global mergetool.trustExitCode false

git config --global diff.external extDiff

 

또는

.gitconfig 파일 편집

 

[merge]

   tool = extMerge

[mergetool  "extMerge"]

   cmd = extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"

   trustExitCode = false

[diff]

   external = extDiff

 

git diff 32d1776b1^ 32d1776b1

 

소스 공백

trainling-space

줄 끝에 공백

spacebefore-tab

줄 처음에 Tab보다 공백이 먼저 나오는 경우

git apply --whitespace=fix <patch>