Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
Bash Git Prompt A Bash script to add git info to the shell prompt. Preferred Installation Method Clone the repository into your home directory. Add the following 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 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. Enjoy!