Programming/Tips

[Git, 단축어 세팅] global setting file, 커스텀 cmd 약어

남남이루 2024. 4. 18. 23:09

global 환경 세팅 파일 : .gitconfig

// gitconfig 파일 vscode로 열기
git config --global -e
[user]
	name = namnameeroo
	email = nami.skageec@gmail.com
[core]
	editor = code
	autocrlf = true
[alias]
	st = status
	ss = status -s
	hist = log --graph --all --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(white)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --date=short
	ba = branch -a
	b = branch
	ckb = checkout -B
	ck = checkout
	cm = commit -m
	lg1 = log --graph --abbrev-commit --decorate --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(auto)%d%C(reset)' --all
	lg2 = 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(auto)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
	lg = lg1
    
    
[init]
	defaultBranch = main

 

 

alias > hist : log볼 때 로그당 text 한줄로 추출해서 색 입혀서 심플하게 보여줌

alias > lg1, lg2 : log볼 때 git lense나 git graph처럼 cmd에서 그래프로 시각적으로 커밋 로그 표현해줌

init > defaultBranch : master브랜치가 아니라 main으로 defaultBranch가 생성되도록 세팅한 것