Bash git prompt for Ubuntu 24.04
This is a bash git prompt with 5 themes that displays usefull information about the current git repository.
Note
This should work fine on other distros as well. I have tested this on Ubuntu 24.04 and Fedora 42.
Prompt Structure.
The default "Out Of The Box" theme appearance of the prompt looks like this.
<branch git status><working directory>
And it looks like this
DejaVuSansMono Nerd Font has to be present in order to display the fancy symbols listed below.
Install via git clone
git clone https://git.x-files.dk/bash/bash-git-prompt.git ~/.bash-git-prompt
Install the required fonts used by the git-bash-prompt
cd ~/.bash-git-prompt
./install-fonts.sh
Getting everything up and running.
Important: Remove all other git prompts you have in your ~/.bashrc file. Then add the following to your ~/.bashrc file.
# Git Prompt Start
if [ -f "$HOME/.bash-git-prompt/bash-git-prompt" ]; then
export GIT_PROMPT_THEME=1
source "$HOME/.bash-git-prompt/bash-git-prompt"
fi
# Git Prompt Stop
Changing themes
This can be done on the fly by simply typing the command "gpchange" followed by a theme number e.g like this:
gpchange 3
Themes
The image is showing the 5 themes with every git status available. I know it's not possible to have a clean and dirty state at the same time, but this is for demo / clarification purpose. The following icons are displayed in this order for demonstraion purpose.
Branch → Staged → Changed → Untracked → Stashed → Ahead → Behind → No-Remote → Conflict → Dirty → Clean
Set your terminal to use the DejaVuSansMono Nerd Font Mono as shown below.
More guides
More guides can be found on [wiki.x-files.dk]
Last tested
June 25th 2025 on Ubuntu 24.04.