Yet another GIT PS1 command

Whenever you develop something and make a mistake when committing (or pushing some code) on the wrong branch onto your SCM server, think of the classic tip of adding the branch name into your shell prompt.

This tip can display each time in the shell the checked out branch and can display some additional info (do you have any locally untracked file, are you behind or ahead of the origin).

Here is a version I made at my work, in 2 flavors :
– a colored version, if your terminal supports it easily (which is unfortunately not the case with konsole or xterm) :
coloredgitps1.txt (rename it to coloredgitps1.bashrc)
– a b&w version, :
whitegitps1 (rename it to whitegitps1.bashrc)

How to integrate that ?
1°) move the git bashrc file to etc
2°) at the begining of your bashrc file, add the following line of unix script :
. /etc/coloredgitps1.bashrc
. /etc/whitegitps1.bashrc
3°) append $(__git_ps1) to the PS1 var
4°) restart your terminal

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *