Replaced HEAD~1 with HEAD^1, prefer semantics.
Refactored bash prompt code for clarity, added documentation.