Search

Search through articles and snippets by title, tags, or content.

Back to Snippets
Bash
Feb 6, 2026

생산성을 높이는 Git 별칭 모음

매일 쓰는 Git 명령어를 별칭으로 등록하여 워크플로우를 가속화합니다.

GitBashProductivity

필수 Git 별칭

.gitconfig에 추가하면 바로 사용할 수 있습니다.

.gitconfig
[alias]
  # 상태 & 로그
  s = status -sb
  lg = log --oneline --graph --decorate -20
  ll = log --pretty=format:'%C(yellow)%h%Creset %s %C(dim)(%cr)%Creset %C(blue)<%an>%Creset' -15
 
  # 브랜치 작업
  co = checkout
  cb = checkout -b
  bd = branch -d
  bm = branch --merged
 
  # 커밋 & 스테이징
  cm = commit -m
  ca = commit --amend --no-edit
  unstage = reset HEAD --
 
  # 리모트
  pf = push --force-with-lease
  pl = pull --rebase
  sync = !git fetch --prune && git rebase origin/main

유용한 Git 함수

더 복잡한 워크플로우는 셸 함수로 만듭니다.

.zshrc
# 브랜치 생성 + 푸시 + PR 한 번에
gpr() {
  local branch="$1"
  local msg="${2:-$branch}"
  git checkout -b "$branch"
  git push -u origin "$branch"
  gh pr create --title "$msg" --fill
}
 
# 머지된 브랜치 정리
gclean() {
  git branch --merged main | grep -v 'main' | xargs -r git branch -d
  echo "Cleaned merged branches."
}