## Git prompt for bash for Ubuntu and other distros. This prompt is a port of magicmonty git prompt located [\[here\]](https://github.com/magicmonty/bash-git-prompt) which again is a port of this one located [\[here\]](https://github.com/olivierverdier/zsh-git-prompt) A bash prompt with theme support that displays usefull information about the current git repository. ### Prompt Structure. The default "Out Of The Box" theme appearance of the prompt is: ```plaintext ( | then a newline ) ``` ### And it looks like this with the default theme.

default layout

### Deafult theme status symbols examples - ``✔``: repository clean - ``●n``: there are ``n`` staged files - ``✖n``: there are ``n`` files with merge conflicts - ``✖-n``: there are ``n`` staged files waiting for removal - ``✚n``: there are ``n`` changed but *unstaged* files - ``…n``: there are ``n`` untracked files - ``⚑n``: there are ``n`` stash entries - ``↑n``: ahead of remote by ``n`` commits - ``↓n``: behind remote by ``n`` commits ### Installing via git clone Remove all references for other git prompts you may have been using before installing then run. ``` git clone https://git.x-files.dk/bash/bash-git-prompt.git ~/.bash-git-prompt ``` ```bash cd ~/.bash-git-prompt ./install-fonts.sh ``` Then add the following to your ~/.bashrc file. ```bash if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then GIT_PROMPT_THEME=Default source "$HOME/.bash-git-prompt/gitprompt.sh" fi ``` ### Fonts All themes except the "Default theme" wich does not use Nerd symbols have been created and tested with Ubuntu 24.04 with the following font DejaVu-Sans-Mono-Nerd-Font-Complete-Mono which is included in the repository. To get the best experience using the supplied themes change your terminal font to use "DejaVuSansMono Nerd Font Mono" ### Changing themes In order to use another theme just change the the theme name in your ~/.bashrc file and close and repoen your terminal. Important the theme name must be entered without the .bgptheme extension. Example to change the "Default" theme with "x-files-fancy-white" all you have to do is change the following line in your ~/.bashrc file ```bash if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then GIT_PROMPT_THEME=Default source "$HOME/.bash-git-prompt/gitprompt.sh" fi ``` To ```bash if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then GIT_PROMPT_THEME=x-files-fancy-white source "$HOME/.bash-git-prompt/gitprompt.sh" fi ``` Then close and reopen your terminal. The following themes are currently provided and can be added to your ~/.bashrc file as shown above. The themes are listed in alphabetical order. x-files-default\ x-files-chevron\ x-files-fancy-white\ x-files-fancy-yellow\ x-files-return\ x-files-return-time\ x-files-robby-russell\ x-files-time ### Screenshot of the aditional themes currently provided with some example symbols using DejaVu-Sans-Mono-Nerd-Font font

x-files-default theme
x-files-default theme example

x-files-chevron theme
x-files-chevron theme example

x-files-fancy-white theme
x-files-fancy-white theme example

x-files-fancy-yellow theme
x-files-fancy-yellow theme example

x-files-return theme
x-files-return theme example

x-files-return-time theme
x-files-return-time theme example

x-files-robby-russell theme
x-files-robby-russell theme example

x-files-time theme
x-files-time theme example

### Note on VS Code In order to get this to work in the VS Code terminal you will have to adjust a few settings for the symbols to render correctly. Open "File -> Preferences -> Settings" then adjust the following.

vscode settings
Search for Terminal Font Family and insert the following DejaVuSansMono Nerd Font

vscode settings
Search for Gpu Acceleration and set it to on

vscode settings
Search for Editor Font Family and insert the following 'DejaVuSansMono Nerd Font', 'monospace', monospace

### More guides More guides can be found on [\[wiki.x-files.dk\]](https://wiki.x-files.dk) ### Last tested January 8th 2025 on Ubuntu 24.04.