Skip to content

Instantly share code, notes, and snippets.

@aseemk
Created March 29, 2012 22:24
Show Gist options
  • Save aseemk/2244361 to your computer and use it in GitHub Desktop.
Save aseemk/2244361 to your computer and use it in GitHub Desktop.
Bash prompt hotness: Git branch, full path, bold text, newline separators. Terminal readability FTW!
# You need to have bash-completion installed, e.g. `brew install bash-completion`.
# And you may need to have git installed this way too, e.g. `brew install git`.
# This is needed for bash completion:
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
# And here's the sexy prompt that shows the Git branch for git repos:
export PS1='\n\033[1m\w$(__git_ps1 " (%s)") $\033[0m '
# Great reference for Bash prompts in general:
# http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
~/Projects/Thingdom (develop) $ git st
# On branch develop
nothing to commit (working directory clean)

~/Projects/Thingdom (develop) $ git br
* develop
  master

~/Projects/Thingdom (develop) $ git co master
Switched to branch 'master'
Your branch is behind 'origin/master' by 3 commits, and can be fast-forwarded.

~/Projects/Thingdom (master) $ git pull
First, rewinding head to replay your work on top of it...
Fast-forwarded master to f263847a8d59170c07e391c6bb77b66441745578.

~/Projects/Thingdom (master) $ git bisect start

~/Projects/Thingdom (master|BISECTING) $ git bisect good develop

~/Projects/Thingdom (master|BISECTING) $ git bisect bad
Bisecting: 8 revisions left to test after this (roughly 3 steps)
[e45887aef731c21ee52357005cb0a81dd8671447] Reverting to f478841 (sync master w/ develop).

~/Projects/Thingdom ((e45887a...)|BISECTING) $ git bisect reset master
Previous HEAD position was e45887a... Reverting to f478841 (sync master w/ develop).
Switched to branch 'master'

~/Projects/Thingdom (master) $ echo "Awesome, isn't it?"
Awesome, isn't it?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment