Skip to content

Git Prompt: a function for adding nominal git info to the Linux Bash command prompt.

Notifications You must be signed in to change notification settings

chaitanyathengdi/git-prompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 

Repository files navigation

git-prompt

Git Prompt: a function for adding nominal git info to the Linux Bash command prompt.

Currently includes

  1. Indicators of:
  • untracked, modified, or added files to the index
  • merge conflicts
  • sync with origin(+ is ahead, - is behind)
  • incomplete/complete merge/rebase
  • stashed changes
  1. The current branch and refname for HEAD

Usage

Copy/paste the code in the file at the end of your .bashrc file. The extra info shows for all git repositories. Shows only in the working directory - not in a bare repository or inside the .git folder.

Commands: As it is now, this utility is not designed to take any input from the user. I could get around to adding a settings file sometime, but that's about it.

Indicator glossary

IndicatorColorMeaning
SBlueYou have stashed changes.
CRedThe latest action(cherry-pick, merge, rebase, ...) caused conflicts.
URedUntracked files are present in your directory.
MRedYou have modified files that are not added to index.
AGreenFiles are present in index.
MrgRedUnfinished merge(due to conflicts).
 GreenFinished merge - make commit to proceed.
RbsRedUnfinished rebase - the current commit has conflicts.
ContGreenConflicts fixed - proceed(with creating commit or continuing rebase/cherry-pick).
HEAD detached atRedSimilar to 'git status', indicates a detached HEAD state.
+m/0GreenYou are m commits ahead of origin - push your changes.
0/-nBlue(After you do a fetch) you are behind origin by n commits. Merge changes.
+m/-nGreen/BlueBoth of the above at the same time(indicates a diverged branch - do a rebase)

Acknowledgements

Contains code taken from http://www.opinionatedprogrammer.com/2011/01/colorful-bash-prompt-reflecting-git-status/

Thanks to Jo Liss for letting me use her code in my project. It's much appreciated.

If you have any suggestions, feel free to post them. Pull requests also welcome.

About

Git Prompt: a function for adding nominal git info to the Linux Bash command prompt.

Resources

Stars

Watchers

Forks

Packages

No packages published