
기본 Git 구성
2022-10-04 last update
7 minutes reading terminal git setup productivitylobotuerto's notes - Basic Git configuration.에서 이 기사의 최신 업데이트 버전을 확인할 수 있습니다.
소개
Got 15 minutes and want to learn Git? A Guided Tour through the Fundamentals of Git (tutorial) Pro Git by Scott Chacon (libro) A visual Git reference Git Quick Reference Git for everyone
How to setup your own private Git repositories with Gitolite How to setup automatic Hugo website generation and deployment with Git
GitHub
gitolite (자체 호스팅) Bitbucket
GitLab (자체 호스팅 가능)
소개
Manjaro Linux 사용자인 경우 컴퓨터에 이미 Git이 있습니다.
Ubuntu 사용자인 경우 다음을 사용하여 설치합니다.
sudo apt install git
다음과 같이 작동하는지 확인할 수 있습니다.
git --version
# git version 2.17.1
새 프로젝트를 초기화하고 커밋할 수 있도록 몇 가지 기본 설정을 진행해 보겠습니다.
사용자 및 이메일
Git은 이 데이터를 사용하여 생성한 커밋을 표시합니다.
git config --global user.name "Your name goes here"
git config --global user.email "[email protected]"
다채로운 CLI
git status
및 git diff
를 수행할 때 컬러 출력을 사용하려면 다음을 수행하십시오.
git config --global color.ui "auto"
CPU 스레드
리포지토리 패킹에 사용할 CPU 스레드의 자동 감지를 활성화하려면:
git config --global pack.threads "0"
유용한 별칭
이것을 ~/.gitconfig
에 추가하십시오.
[alias]
l = log --oneline --decorate --graph
ll = log --graph --abbrev-commit --decorate --date=relative \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) \
%C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
lll = log --graph --abbrev-commit --decorate --date=relative \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) \
%C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' \
--branches
co = checkout
ci = commit
man = help
h = help
a = add
f = fetch
d = diff
dc = diff --cached
dt = difftool
dtc = difftool --cached
ds = diff --stat
dsc = diff --stat --cached
s = status --short --branch
b = branch
[credential]
helper = cache
[diff]
algorithm = patience
글로벌 .gitignore
전역 .gitignore 파일을 정의해 보겠습니다.
git config --global core.excludesfile ~/.gitignore_global
Visual Studio Code 프로젝트 파일과 ElixirLS 플러그인에 의해 생성된 파일을 무시하는 데 사용하겠습니다.
echo ".vscode/" >> ~/.gitignore_global
echo ".elixir_ls/" >> ~/.gitignore_global
줄 끝 처리
리눅스 / 맥
Linux/Mac 사용자인 경우:
git config --global core.autocrlf input
git config --global core.safecrlf true
창
Windows 사용자인 경우:
git config --global core.autocrlf true
git config --global core.safecrlf true
연결
기초
sudo apt install git
git --version
# git version 2.17.1
git config --global user.name "Your name goes here"
git config --global user.email "[email protected]"
git config --global color.ui "auto"
git config --global pack.threads "0"
[alias]
l = log --oneline --decorate --graph
ll = log --graph --abbrev-commit --decorate --date=relative \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) \
%C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
lll = log --graph --abbrev-commit --decorate --date=relative \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) \
%C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' \
--branches
co = checkout
ci = commit
man = help
h = help
a = add
f = fetch
d = diff
dc = diff --cached
dt = difftool
dtc = difftool --cached
ds = diff --stat
dsc = diff --stat --cached
s = status --short --branch
b = branch
[credential]
helper = cache
[diff]
algorithm = patience
git config --global core.excludesfile ~/.gitignore_global
echo ".vscode/" >> ~/.gitignore_global
echo ".elixir_ls/" >> ~/.gitignore_global
git config --global core.autocrlf input
git config --global core.safecrlf true
git config --global core.autocrlf true
git config --global core.safecrlf true
기초
고급 사용 사례
호스팅 서비스
gitolite (자체 호스팅)
GitLab (자체 호스팅 가능)