HTTPS clone URL
Subversion checkout URL
Addon script to provide a short git prompt info to a bash prompt
|Failed to load latest commit information.|
|git_prompt.sh||Made git_remote_check optional per jmhobbs request|
|git_remote_check.sh||Fixed issue with multiple remotes configured in repository|
Bash Git Prompt A Bash script to add git info to the shell prompt. Preferred Installation Method Clone the repository into your home directory. For Ubuntu: Add the following two source lines to your ~/.bashrc file all the way at the bottom: source $HOME/Bash-Git-Prompt/git_remote_check.sh source $HOME/Bash-Git-Prompt/git_prompt.sh For Mac OS X: By default a .profile file does not exist in the home directory. Create one using "touch ~/.profile" if it does not exist then add the same two lines to it as for Linux: source $HOME/Bash-Git-Prompt/git_remote_check.sh source $HOME/Bash-Git-Prompt/git_prompt.sh If remote tracking is not required then only add the following line to your ~/.bashrc or ~/.profile all the way at the bottom: source $HOME/Bash-Git-Prompt/git_prompt.sh If in a terminal shell then exit and open a new shell. Usage Bash shell prompt will change to display repository information when a change directory is done into a git working tree. The prompt will display various info, for example: user@system(89m|master|?AM)(up to date)$ 89m: Last commit was 89 minutes ago. Color will go from green to yellow to red depending on how long ago a commit was performed. Green<60m<Yellow<120m<Red If minutes span more than one day then the number of days are displayed as well. master: On branch master ?AM: Git file flags. '?' for untracked files. 'A' for newly added uncommited files. 'M' for modified uncommited files. (up to date) : local tracking branch is up to date with remote. Remote check is done in the background after 5 minutes have passed since the last check and a carriage return is hit in the bash shell. If a connection problem exists the user is notified. To allow the background remote check a temporary file is created/deleted in /tmp directory. Inside a git working tree use 'rd' to cd all the way to the root directory of the project. Tested on Ubuntu 10.04. Tested on Mac OS X Lion. Enjoy!