티스토리 뷰
Ubuntu 터미널에서 현재 directory가 git 인 경우 git branch 를 표시하도록 하는 방법을 공유드립니다.
~/.bashrc 맨 끝에 아래의 내용을 추가하면 됩니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
export PS1="\e[01;32m\u@\h \[\e[34m\]\w\[\e[91m\]\$(parse_git_branch)\[\e[00m\]$ " |
적용 후 터미널을 다시 열거나 source ~/.bashrc 를 하면 적용됩니다.

반응형