BASH GIT prompt

28 Nov 2012 [ Bash  Blog  Linux  ]

I’d like to introduce you my bash shell which can handle GIT information.

More information and sources are hosted on Github.

Let’s start from left, first is login & hostname combination followed by background processes counter and end with current directory.

Next line start with actual bash history position.


Working with GIT

When you enter some git repository, prompt give you some extra line with GIT information. Line starts with word GIT and actual branch name.

There are also some extra chars and numbers. They represent uncommited changes in your repository (like git status).

M – modified files

A – added files

D – deleted files

When you do some changes, prompt show you actual status of your git repository

Add file to GIT

Modify file managed by GIT

Local repository vs remote

When you do some changes and commit them, your state is 1 commit ahead of remote.

It is very useful to know how many commits you have unpushed.

Another situation could be, you are working on your local repository and you do **git fetch** to get files from remote repository. Prompt show you how many commits you are behind of remote.

Small arrow show you commits flow and it’s followed by number of commits

->   you are ahead of remote

-<-   you are behind of remote


Prompt support also stash signalization