Development

MAC에서 __git_ps1 적용하기 (prompt에 branch 이름 나오도록)

chbae 2023. 4. 20. 21:57
728x90
반응형

MAC에서 __git_ps1을 적용하면 -bash: __git_ps1: command not found 과 같은 에러가 나온다. 아래와 같이 사용하면 git 저장소를 가진 디렉토리로 들어가면 branch 이름이 prompt에 나오게 된다. 아래는 필자가 사용하는 PS1 이다.

 

changhyeok.bae@Changhyeoks-MBP~/work/yocto/poky (krogoth) $ cat ~/.bash_profile

source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh  
export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\]\w\[\033[01;33m\]$(__git_ps1)\[\033[01;34m\] \$\[\033[00m\] '

 

Referencehttps://stackoverflow.com/questions/12870928/mac-bash-git-ps1-command-not-found

728x90