Todd Wolfson

Software Engineer

August 15, 2013

My bash prompt has evolved enough from its initial fork that I have decided to open source it.

It is a 2 line prompt that provides session information with distinct symbols for each git status combination.

sexy-bash-prompt screenshot


A very long time ago, I was watching a Paul Irish screencast and saw sexy-bash-prompt for the first time. It took me a few tries to find but finally I discovered it hiding in a gist.

For reference, the most up-to-date original can be found in gf3/dotfiles

Original sexy-bash-prompt screenshot


After finding the original, I forked it into my dotfiles and updated the colors to be colder (e.g. bluer).

Eventually, I wanted to display when commits have not been pushed. From this, the triangles were born.

Initial fork of sexy-bash-prompt screenshot

Keen observers will note the triangle in this prompt are smaller than the current one. The triangles were enlarged after using OSX for work where the original triangles were very small.

From this, I had some experiments with displaying more information but they fizzled (e.g. trailing slashes to show how many commits were unpushed).

▵ = ahead by 1
▵\ = ahead by 2
▵\\ = ahead by 3

Owning your identity

In July 2013, I decided to add the unpulled status to my bash prompt. This opened the introduced 4 more bash statuses that I had to manually test. Before this, it was a little tedious to test but it wasn't unbearable.

To prevent wasting further time, I wrote a flat file based test suite making tests easily addable and debuggable.

The payoff of this has been amazing; debugging is a breeze and Travis CI now tests 2 versions of git.

After the test suite was built, I went forward and built the new statuses. Then, looking over the code, I realized it was quite mature for a dotfiles script and broke it out.

The prompt you see before you is the final sexy product.

sexy-bash-prompt screenshot

Top articles

Develop faster

Removing the tedium from creating, developing, and publishing repos.

Recent articles

Parallel visual testing

Comparison of parallelization techniques for visual testing

Utility oriented testing

How to make code reusable in Mocha (BDD)