Skip to content

Instantly share code, notes, and snippets.

@xhlwill
Last active December 27, 2017 18:22
Show Gist options
  • Save xhlwill/688c92d8a6026085fffe4ab6c97855ae to your computer and use it in GitHub Desktop.
Save xhlwill/688c92d8a6026085fffe4ab6c97855ae to your computer and use it in GitHub Desktop.
修改 .bash_profile(mac) 或 .bashrc(linux) 让 terminal 能自动补全 git 命令、显示 git 分支等信息 (git-completion.bash 和 git-prompt.sh 放入 ~ 目录)
source ~/git-completion.bash
source ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE="true"
export GIT_PS1_SHOWSTASHSTATE="true"
export GIT_PS1_SHOWUNTRACKEDFILES="true"
export GIT_PS1_SHOWUPSTREAM="auto"
export GIT_PS1_SHOWCOLORHINTS="true"
green=$'\e[0;32m'
magenta=$'\e[0;35m'
yellow=$'\e[0;33m'
normal_colours=$'\e[m'
PS1='\[$green\]\u@\h:\W\[$magenta\]$(__git_ps1 " (%s)")\[$yellow\]\$\[$normal_colours\] '
alias ls='ls -G'
alias ll='ls -alG'
@xuguangwu
Copy link

thank you ,it's useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment