Skip to content

Instantly share code, notes, and snippets.

@zoras
Created October 8, 2010 04:06
Show Gist options
  • Save zoras/616341 to your computer and use it in GitHub Desktop.
Save zoras/616341 to your computer and use it in GitHub Desktop.
Git tab completion
# In ~/.bash_profile
# Git tab completion
# source /usr/local/etc/bash_completion.d/git-completion.bash
# homebrew => source /usr/local/Cellar/git/1.7.2.3/etc/bash_completion.d/git-completion.bash
# copied file to ~/.git-completion.sh
source ~/.git-completion.sh
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUPSTREAM="auto"
export GIT_PS1_SHOWSTASHSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
# PS1='\[\e[0;32m\][\w]$(__git_ps1 " %s")\n\u@\h$\[\e[m\] '
PS1='\[\033[1;33m\]\u\[\033[0m\]@\[\033[1;33m\]\h \[\033[0m\]\w\[\033[1;33m\]$(__git_ps1 " %s")\[\033[0m\] \$ '
# Some more information can be added with flags (see comments in git-completion.bash).
# The first line points at your git completion file.
# GIT_PS1_SHOWDIRTYSTATE displays unstaged changes “*” or staged changes “+” next to the branch name.
# GIT_PS1_SHOWUPSTREAM=”auto” indicates if you are behind “<", ahead ">” or diverged “<>“.
# All 4 set that you want to show an notification when you have changes or something in your stash.
# The final line changes your bash shell prompt.
# Change text color to yellow: \[\033[1;33m\]
# Change text color to white: \[\033[0m\]
# Show user name: \u
# Show location: \h
# Show current working directory and path: \w
# Show git status: $(__git_ps1 " %s")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment