Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jimeh committed Nov 13, 2009
1 parent e13bbc4 commit f7b55b1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@ Working with Git and it's great branching/merging features is amazing. Constantl

The solution to this is to have your terminal prompt display the current branch. There's a [number][1] [of][3] [articles][3] [available][4] online about how to achieve this.

I based this project mainly on [Aaron Crane's solution][1].
I based this project mainly on Aaron Crane's [solution][1].

[1]: http://aaroncrane.co.uk/2009/03/git_branch_prompt/
[2]: http://railstips.org/2009/2/2/bedazzle-your-bash-prompt-with-git-info
[3]: http://techblog.floorplanner.com/2008/12/14/working-with-git-branches/
[4]: http://www.intridea.com/2009/2/2/git-status-in-your-prompt


## Overview

If you `cd` to a Git working directory, you will see the current Git branch name displayed in your terminal prompt like so:

![Git Branch in Prompt](http://snap.jimeh.me/git-branch-in-prompt.png)

When you're not in a Git working directory, your prompt works like normal.


## Installation

Clone the project to a `.bash` folder in your home directory:
Expand All @@ -24,19 +33,14 @@ Edit your `~/.bash_profile` or `~/.profile` and add the following to the top:
source $DOTBASH/main.sh
PS1="\u@\h:\w\[$txtcyn\]\$git_branch\[$txtrst\]\\$ "

Configure your prompt by editing the `PS1 variable`. For a list of available colors check `colors.sh`.


## Screenshot

![Git Branch in Prompt](http://snap.jimeh.me/git-branch-in-prompt.png)

## Configuring

## Issues
If you followed the above installation instructions, you've added the default prompt style already by defining the `PS1` variable. If you don't know how to customize your prompt, I recommend you check [this][1] how-to.

Please report any issues and bugs [here][1] on GitHub.
Basically, to have the current Git branch shown, simply add `$git_branch` to your `PS1` variable, and make sure the variable value is defined with double quotes. A set of color variables have also been set for you to use. For a list of available colors check `colors.sh`.

[1]: http://github.com/jimeh/git-branch-in-prompt/issues
[1]: http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html


## License
Expand Down
15 changes: 11 additions & 4 deletions colors.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
txtblk='\e[0;30m' # Black - Regular
# Regular
txtblk='\e[0;30m' # Black
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold

# Bold
bldblk='\e[1;30m' # Black
bldred='\e[1;31m' # Red
bldgrn='\e[1;32m' # Green
bldylw='\e[1;33m' # Yellow
bldblu='\e[1;34m' # Blue
bldpur='\e[1;35m' # Purple
bldcyn='\e[1;36m' # Cyan
bldwht='\e[1;37m' # White
unkblk='\e[4;30m' # Black - Underline

# Underline
unkblk='\e[4;30m' # Black
undred='\e[4;31m' # Red
undgrn='\e[4;32m' # Green
undylw='\e[4;33m' # Yellow
undblu='\e[4;34m' # Blue
undpur='\e[4;35m' # Purple
undcyn='\e[4;36m' # Cyan
undwht='\e[4;37m' # White
bakblk='\e[40m' # Black - Background

# Background
bakblk='\e[40m' # Black
bakred='\e[41m' # Red
badgrn='\e[42m' # Green
bakylw='\e[43m' # Yellow
Expand Down

0 comments on commit f7b55b1

Please sign in to comment.