mirror of
https://github.com/jimeh/git-aware-prompt.git
synced 2026-02-19 13:36:38 +00:00
updated readme
This commit is contained in:
24
README.md
24
README.md
@@ -4,7 +4,7 @@ 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.
|
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/
|
[1]: http://aaroncrane.co.uk/2009/03/git_branch_prompt/
|
||||||
[2]: http://railstips.org/2009/2/2/bedazzle-your-bash-prompt-with-git-info
|
[2]: http://railstips.org/2009/2/2/bedazzle-your-bash-prompt-with-git-info
|
||||||
@@ -12,6 +12,15 @@ I based this project mainly on [Aaron Crane's solution][1].
|
|||||||
[4]: http://www.intridea.com/2009/2/2/git-status-in-your-prompt
|
[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:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
When you're not in a Git working directory, your prompt works like normal.
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Clone the project to a `.bash` folder in your home directory:
|
Clone the project to a `.bash` folder in your home directory:
|
||||||
@@ -24,19 +33,14 @@ Edit your `~/.bash_profile` or `~/.profile` and add the following to the top:
|
|||||||
source $DOTBASH/main.sh
|
source $DOTBASH/main.sh
|
||||||
PS1="\u@\h:\w\[$txtcyn\]\$git_branch\[$txtrst\]\\$ "
|
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`.
|
|
||||||
|
|
||||||
|
## Configuring
|
||||||
|
|
||||||
## Screenshot
|
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.
|
||||||
|
|
||||||

|
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://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
|
||||||
## Issues
|
|
||||||
|
|
||||||
Please report any issues and bugs [here][1] on GitHub.
|
|
||||||
|
|
||||||
[1]: http://github.com/jimeh/git-branch-in-prompt/issues
|
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|||||||
15
colors.sh
15
colors.sh
@@ -1,4 +1,5 @@
|
|||||||
txtblk='\e[0;30m' # Black - Regular
|
# Regular
|
||||||
|
txtblk='\e[0;30m' # Black
|
||||||
txtred='\e[0;31m' # Red
|
txtred='\e[0;31m' # Red
|
||||||
txtgrn='\e[0;32m' # Green
|
txtgrn='\e[0;32m' # Green
|
||||||
txtylw='\e[0;33m' # Yellow
|
txtylw='\e[0;33m' # Yellow
|
||||||
@@ -6,7 +7,9 @@ txtblu='\e[0;34m' # Blue
|
|||||||
txtpur='\e[0;35m' # Purple
|
txtpur='\e[0;35m' # Purple
|
||||||
txtcyn='\e[0;36m' # Cyan
|
txtcyn='\e[0;36m' # Cyan
|
||||||
txtwht='\e[0;37m' # White
|
txtwht='\e[0;37m' # White
|
||||||
bldblk='\e[1;30m' # Black - Bold
|
|
||||||
|
# Bold
|
||||||
|
bldblk='\e[1;30m' # Black
|
||||||
bldred='\e[1;31m' # Red
|
bldred='\e[1;31m' # Red
|
||||||
bldgrn='\e[1;32m' # Green
|
bldgrn='\e[1;32m' # Green
|
||||||
bldylw='\e[1;33m' # Yellow
|
bldylw='\e[1;33m' # Yellow
|
||||||
@@ -14,7 +17,9 @@ bldblu='\e[1;34m' # Blue
|
|||||||
bldpur='\e[1;35m' # Purple
|
bldpur='\e[1;35m' # Purple
|
||||||
bldcyn='\e[1;36m' # Cyan
|
bldcyn='\e[1;36m' # Cyan
|
||||||
bldwht='\e[1;37m' # White
|
bldwht='\e[1;37m' # White
|
||||||
unkblk='\e[4;30m' # Black - Underline
|
|
||||||
|
# Underline
|
||||||
|
unkblk='\e[4;30m' # Black
|
||||||
undred='\e[4;31m' # Red
|
undred='\e[4;31m' # Red
|
||||||
undgrn='\e[4;32m' # Green
|
undgrn='\e[4;32m' # Green
|
||||||
undylw='\e[4;33m' # Yellow
|
undylw='\e[4;33m' # Yellow
|
||||||
@@ -22,7 +27,9 @@ undblu='\e[4;34m' # Blue
|
|||||||
undpur='\e[4;35m' # Purple
|
undpur='\e[4;35m' # Purple
|
||||||
undcyn='\e[4;36m' # Cyan
|
undcyn='\e[4;36m' # Cyan
|
||||||
undwht='\e[4;37m' # White
|
undwht='\e[4;37m' # White
|
||||||
bakblk='\e[40m' # Black - Background
|
|
||||||
|
# Background
|
||||||
|
bakblk='\e[40m' # Black
|
||||||
bakred='\e[41m' # Red
|
bakred='\e[41m' # Red
|
||||||
badgrn='\e[42m' # Green
|
badgrn='\e[42m' # Green
|
||||||
bakylw='\e[43m' # Yellow
|
bakylw='\e[43m' # Yellow
|
||||||
|
|||||||
Reference in New Issue
Block a user