2025-06-26 13:40:07 +02:00
2025-06-24 14:21:44 +02:00
2025-06-24 14:21:44 +02:00
2025-06-26 13:40:07 +02:00
2025-06-24 14:21:44 +02:00
2025-06-26 08:36:30 +02:00
2025-06-26 08:37:56 +02:00

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

default theme

DejaVuSansMono Nerd Font has to be present in order to display the fancy symbols listed below.

extended symbols

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

extended symbols

Set your terminal to use the DejaVuSansMono Nerd Font Mono as shown below.

Terminal font settings

More guides can be found on [wiki.x-files.dk]

Last tested

June 25th 2025 on Ubuntu 24.04.

Description
No description provided
Readme MIT 891 KiB
Languages
Shell 100%