bash-git-prompt/README.md
2025-06-24 15:15:30 +02:00

2.2 KiB

Bash git prompt for Ubuntu desktop 24.04

This is a bash git prompt with 5 themes that displays usefull information about the current git repository.

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

To display the fancy symbols DejaVuSansMono Nerd Font Mono needs to be present.

extended symbols

Install via git clone

git clone https://git.x-files.dk/ubuntu-desktop/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

January 8th 2025 on Ubuntu 24.04.