Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save alexandreliberato/0ce01cac3761a2d161a332ab98c19f34 to your computer and use it in GitHub Desktop.

Select an option

Save alexandreliberato/0ce01cac3761a2d161a332ab98c19f34 to your computer and use it in GitHub Desktop.
'tcsh' Git prompt to show current branch
# in ~/bin/gitprompt.csh:
setenv GIT_BRANCH_CMD "sh -c 'git branch --no-color 2> /dev/null' | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'"
set prompt="%m:%~ `$GIT_BRANCH_CMD`%B%#%b "
# and then in ~/.cshrc:
alias precmd "source ~/bin/gitprompt.csh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment