Go to file
2025-01-09 10:54:35 +01:00
fonts initial commit 2025-01-09 10:54:35 +01:00
themes initial commit 2025-01-09 10:54:35 +01:00
git-prompt-help.sh initial commit 2025-01-09 10:54:35 +01:00
gitprompt.sh initial commit 2025-01-09 10:54:35 +01:00
gitstatus.sh initial commit 2025-01-09 10:54:35 +01:00
install-fonts.sh initial commit 2025-01-09 10:54:35 +01:00
prompt-colors.sh initial commit 2025-01-09 10:54:35 +01:00
README.md initial commit 2025-01-09 10:54:35 +01:00

Git prompt for bash for Ubuntu and other distros.

This prompt is a port of magicmonty git prompt located [here] which again is a port of this one located [here]

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:

(<last status> <working dir> <branch> <upstream branch>|<branch tracking> then a newline <with current time>)

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
cd ~/.bash-git-prompt
./install-fonts.sh

Then add the following to your ~/.bashrc file.

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

if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
    GIT_PROMPT_THEME=Default
    source "$HOME/.bash-git-prompt/gitprompt.sh"
fi

To

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 can be found on [wiki.x-files.dk]

Last tested

January 8th 2025 on Ubuntu 24.04.