Skip to content

Instantly share code, notes, and snippets.

@ivanbogomoloff
Created October 23, 2018 20:56
Show Gist options
  • Save ivanbogomoloff/a4e9a092fc36befc6321bc8a65bf049c to your computer and use it in GitHub Desktop.
Save ivanbogomoloff/a4e9a092fc36befc6321bc8a65bf049c to your computer and use it in GitHub Desktop.
git and hg branch in prompt PS1
# .bashrc
# ~/.bashrc file
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
force_color_prompt=yes
gb() {
#git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(git:\1)/'
}
hgb() {
hg branch 2> /dev/null | awk '{b="(hg:"$1")"; print b;}'
}
export PS1="\[\033[1;37m\]\w(\D{%T})\[\033[33m\]\$(gb)\$(hgb)\[\033[00m\]$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment