First off, I shamelessly stole this from http://www.bramschoenmakers.nl/en/node/624 But I wanted to be able to find it quickly
* ssh into your Homestead vagrant box
* Update the Ubuntu packages with `sudo apt-get update`
* Install bash-completion with `sudo apt-get install bash-completion`
* Open up your .bashrc file by with `vim ~/.bashrc`
* Toward the top (somewhere above where the `PS1=` is) add this
```shell
# Bash completion
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
export GIT_PS1_SHOWDIRTYSTATE=1
```
(The if statement checks on if the package installed)
* On the way down the page, might as well uncomment `force_color_prompt=yes` (remove the hash from the first character of the line)
* Below that you will find
```
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
```
You will need to add in `PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[01;33m\]$(__git_ps1)\[\033[01;34m\] \$\[\033[00m\] '` which for me looks like
```
if [ "$color_prompt" = yes ]; then
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[01;33m\]$(__git_ps1)\[\033[01;34m\] \$\[\033[00m\] '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
```
when I am done.
* Save that file and at the prompt type `source ~/.bashrc` to reload it.
* If you go into a directory with git you will see what branch you have checked out as well as a `+` if there are files to add (`git add --all`) and a `*` if there are uncommited files (`git commit -m ':cake:'`)
There you go!
Updating Homestead (Ubuntu 14.04) prompt to show git status
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.