Git Alias : 커스텀 명령어 설정

Sangyeon·2022년 7월 30일
0

Git

목록 보기
2/12
post-thumbnail

git 명령어의 커스텀 명령어(단축어)를 설정하는 방법에 대한 포스팅 입니다.

설정 파일에서 설정

  • global 설정 파일 위치 : ~/.gitconfig 또는 ~/.config/git/config
  • local 설정 파일 위치 : 프로젝트명/.git/config
[alias]
	l = log
	st = status
    cm = commit -m

위와 같이 설정하면,
$ git log 대신 $ git l
$ git status 대신 $ git st
$ git commit -m "커밋메시지" 대신 $ git cm "커밋메시지"
를 입력함으로써 기존 명령어를 단축어로 실행할 수 있습니다.

커맨드 라인에서 설정

(시스템 전체가 아닌 특정 프로젝트에만 설정을 적용하고 싶은 경우, --global 옵션을 제외해야 합니다.)

$ git config --global alias.<단축키> <기존명령어>
$ git config --global alias.st status

Reference

아래 링크에서 Git Alias 커스텀 명령어 설정 예시를 참고할 수 있습니다.
https://github.com/GitAlias/gitalias

profile
I'm a constant learner.

0개의 댓글