Hacker News new | ask | show | jobs
by zerof1l 2023 days ago
brname () {

  a=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
  if [ -n "$a" ]; then
    echo " [$a]"
  else
    echo ""
  fi
}

PS1="\u@\h:\w\$(brname)$ "

credit: daniel.haxx.se, https://news.ycombinator.com/item?id=25043731

1 comments

You’d like https://ohmyz.sh/. This feature comes with the git plugin.