fonts | ||
themes | ||
gitprompt.sh | ||
gitstatus.sh | ||
gpchange.sh | ||
gpthemes.sh | ||
install-fonts.sh | ||
prompt-colors.sh | ||
README.md |
Bash git prompt for Ubuntu desktop 22.04 and 24.04
This is a bash git prompt with theme support that displays usefull information about the current git repository.
This prompt is a fork of magicmonty git prompt located [here] which again is a port of this one located [here] I suspect none of the ports are maintained anlylonger and this is why I decided to fork it. Besides a few changes to the original port new themes has been created and some themes has been removed.
Prompt Structure.
The default "Out Of The Box" theme appearance of the prompt looks like this. I removed the time stamp from the default theme btw.
<last status><working dir><branch><upstream branch>|<branch tracking>
And it looks like this with the default theme.
Theme symbols used with the default theme.
Theme symbols used with the additional themes provided requires DejaVuSansMono Nerd Font Mono to be present.
Install via git clone
git clone https://git.x-files.dk/ubuntu-desktop/bash-git-prompt.git ~/.bash-git-prompt
Install the required fonts needed for all other themes exept the deafault theme.
cd ~/.bash-git-prompt
./install-fonts.sh
Next set your terminal to use the DejaVuSansMono Nerd Font Mono as shown below.
Getting everything up and running.
Important: Remove all references for other git prompts you may have running. Then add the following to your ~/.bashrc file.
if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
GIT_PROMPT_THEME=default
alias gpchange="bash $HOME/.bash-git-prompt/gpchange.sh"
alias gpthemes="bash $HOME/.bash-git-prompt/gpthemes.sh"
source "$HOME/.bash-git-prompt/gitprompt.sh"
fi
Changing themes method 1
Edit your ~/.bashrc file and change the line GIT_PROMPT_THEME=theme with another theme. For example to change the default theme to something else change.
if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
GIT_PROMPT_THEME=default
alias gpchange="bash $HOME/.bash-git-prompt/gpchange.sh"
alias gpthemes="bash $HOME/.bash-git-prompt/gpthemes.sh"
source "$HOME/.bash-git-prompt/gitprompt.sh"
fi
To
if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
GIT_PROMPT_THEME=fancy-white
alias gpchange="bash $HOME/.bash-git-prompt/gpchange.sh"
alias gpthemes="bash $HOME/.bash-git-prompt/gpthemes.sh"
source "$HOME/.bash-git-prompt/gitprompt.sh"
fi
Then close and reopen your terminal.
Changing themes method 2
In your terminal type gpchange and type name of the theme you would like to use. Then close and reopen your terminal. The following themes are currently provided and can be added to your ~/.bashrc file as shown above or using the gpchange command.
default
fancy-orange
fancy-white
fancy-gold
half-life
hazard
robby-russell
this-way
two-liner
two-liner-time
x-files
x-files-time
Display all themes in the terminal.
You can run the command gpthemes in your terminal in order to get a showcase of all available themes.
Screenshot of the additional themes currently provided.
Theme name: x-files
Theme name: x-files-time
Theme name: robby-russel
Theme name: this way
Theme name: two-liner
Theme name: two-liner-time
Theme name: fancy-white
Theme name: fancy-gold
Theme name: fancy-orange
Theme name: half-life
Theme name: hazard
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.
Search for Terminal Font Family and insert the following DejaVuSansMono Nerd Font
Search for Gpu Acceleration and set it to on
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]
Last tested
January 8th 2025 on Ubuntu 24.04.