Skip to content

Instantly share code, notes, and snippets.

@tknerr
Created February 28, 2018 06:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tknerr/158edbe2d3c49a1bb20c44c4b1d766ff to your computer and use it in GitHub Desktop.
Save tknerr/158edbe2d3c49a1bb20c44c4b1d766ff to your computer and use it in GitHub Desktop.
A Git Bash Prompt for Ubuntu 16.04
#!/bin/bash
export PS1='`if [ $? = 0 ]; then echo "\[\e[32m\] ✔ "; else echo "\[\e[31m\] ✘ "; fi`\[\e[00;37m\]\u\[\e[01;30m\]@\[\e[00;37m\]\h\[\e[01;37m\]:\[\e[01;34m\]\w\[\e[00;34m\] `[[ $(git status 2> /dev/null | head -n3 | tail -n1) != "Changes to be committed:" ]] && echo "\[\e[01;31m\]" || echo "\[\e[01;33m\]"``[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] || echo "\[\e[01;32m\]"`$(__git_ps1 "(%s)")`echo "\[\e[00m\]"`\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment