Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Saturday, August 25, 2012

Bash prompt

After attending the Cool Git Tricks talk by Carina Zona at Women Who Code Lightning Talk this Tuesday, I decided to add git status to my bash prompt.

Here is how it looks like in action:

chiuki@moomin 09:50 ~/github/android-square-view master $

  • username@hostname: Basic info.
  • Time: I show time in my prompt so I can start a long-running job and go to lunch. The prompt will be displayed the moment the job returns, so I can subtract and see how long it took.
  • Current directory: Gives me some context.
  • git branch: I show it in blue when I am in master, purple otherwise.
  • git status: I show a red star if the current directory is dirty.
  • $: The color indicates if the last command was successful. Green for success, red for failure.

So if I'm on the release branch, has pending changes, and the last command failed, my prompt would look like this:

chiuki@moomin 10:05 ~/github/android-square-view release* $

What do you show on your shell prompt?