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

72 lines
2.2 KiB
Markdown

## 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.
```plaintext
<branch><git status><working directory>
```
### And it looks like this
<p align="left" width="100%">
<img src="https://git.x-files.dk/assets/gittheme1.png" alt="default theme"/>
</p>
### To display the fancy symbols DejaVuSansMono Nerd Font Mono needs to be present.
<p align="left" width="100%">
<img src="https://git.x-files.dk/assets/bgp-extended-symbols.png" alt="extended symbols"/>
</p>
### 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
```bash
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.
```bash
# 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:
```bash
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
<p align="left" width="100%">
<img src="https://git.x-files.dk/assets/bgp-extended-symbols.png" alt="extended symbols"/>
</p>
### Set your terminal to use the DejaVuSansMono Nerd Font Mono as shown below.
<p align="left" width="100%">
<img src="https://git.x-files.dk/assets/bgp-terminal.png" alt="Terminal font settings"/>
</p>
### More guides
More guides can be found on [\[wiki.x-files.dk\]](https://wiki.nopants.dk)
### Last tested
January 8th 2025 on Ubuntu 24.04.