개발과 잡지식

Git03 - Git alias 본문

git

Git03 - Git alias

잘하고싶은잉여 2020. 12. 25. 16:06

git alias

명령어에 별명을 붙여서 사용하는 방법이다.

git checkout master => git co master

git status => git st

git commit -am "something" => git cm -am "something"

 

위와 같이 명령어가 짧아지는 것을 볼 수 있다.!

setting

unix 기반인 컴퓨터들은 mac, 우분투

~/.gitconfig 파일에 아래 내용을 붙여 쓰면 된다.

  • vi, vim, nano, gedit 다 가능 하다.

윈도우는.. 아마 사용자 폴더 아래에 .gitconfig 찾아서 변경해 주면 될것 같다.

[alias]
    co = checkout
    rb = rebase -i HEAD~
    st = status
    cm = commit
    pl = pull
    ps = push
    lg = log --graph --abbrev-commit --decorate --format=format:'%C(cyan)%h%C(reset) - %C(green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(yellow)%d%C(reset)' --all
    ad = add
    tg = tag -n
    df = diff
    br = branch

출처 및 참고 : https://jeonghwan-kim.github.io/2016/08/16/git-alias.html

'git' 카테고리의 다른 글

Git04 - Git ignore  (0) 2020.12.25
Git02 - Git remote and local  (0) 2020.12.25
Git01 - Git branch, Commit  (0) 2020.12.25
Git00 - Git 이란?  (0) 2020.12.25