2026-01-24

git alias로 명령 단축

자주 쓰는 명령을 alias로 단축하는 방법을 정리합니다.

Rhio Kim

Rhio Kim

CEO

#git#alias

Page reactions

Leave a quick reaction to this shorts.

반응을 불러오는 중...

!!steps

!duration 180.0

!

_10
# 간단한 상태 확인 별칭
_10
$ git config --global alias.st "status -sb"
_10
_10
# 사용 예제
_10
$ git st
_10
## main
_10
M README.md
_10
?? new-file.txt

!!steps

!duration 240.0

!

_10
# 그래픽 로그 출력
_10
$ git config --global alias.lg "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'"
_10
_10
# 실행 결과
_10
$ git lg
_10
* 1a2b3c4 - Update API endpoint (John Doe) (HEAD -> main)
_10
| * d4e5f6g - Add login feature (Jane Smith) (feature/login)
_10
|/
_10
* 8e9f0a1 - Initial commit (Admin)

!!steps

!duration 180.0

!

_10
# 단축 커밋 명령
_10
$ git config --global alias.ci "commit -m"
_10
_10
# 사용 예제
_10
$ git ci "Update documentation"
_10
[main 3a4b5c6] Update documentation
_10
1 file changed, 5 insertions(+)

!!steps

!duration 240.0

!

_10
# 복잡한 병합 충돌 해결 플로우
_10
$ git config --global alias.resolve "!f() { git add . && git commit -m 'Resolve conflicts'; }; f"
_10
_10
# 충돌 후 실행
_10
$ git resolve
_10
[main 5d6e7f8] Resolve conflicts

!!steps

!duration 300.0

!

_10
# 외부 스크립트 연동
_10
$ git config --global alias.changelog "!sh -c 'git log $1..$2 --pretty=format:\"%h %s\"'"
_10
_10
# 버전 간 변경사항 확인
_10
$ git changelog v1.0 v1.1
_10
3a4b5c6 Add new API endpoint
_10
8e9f0a1 Fix security vulnerability