GitPrompt is multi-threaded C++ program design to display all relevant Git information inside your shell prompt, such as Git status.
I designed GitPrompt to work only on Linux. Keeps GitPrompt simple and fast. I'm assuming most developers are working on Linux if not come join the fun! But if there is enough demand I could make a Windows or Mac version.
Prints and color codes every file inside the shell prompt. To see all 20 different color codes checkout Git Status Color Codes
Shows the latest commit log of the current branch in gray text.
Shows the current git branch in the red background.
Shows the number of git stashes in the purple background. Note if the number of stashes is zero then this section will not print.
Shows if your currently rebasing in the green background.
Shows if your are currently merging and with which branch.
Status | Color |
---|---|
Modified File | |
New File(Self) | |
New File(Them) | |
New File(Both) | |
Deleted File(Self) | |
Deleted File(Them) | |
Deleted File(Both) |
git clone git@github.com:Dosx001/GitPrompt.git
cd GitPrompt
cmake CMakeLists.txt
make
sudo ln -s /PATH/TO/DIR/GitPrompt/bin/gitprompt /usr/bin/git-prompt
paru -S git-prompt
yay -S git-prompt
You might see weird symbols like this one . Just install Nerd Font.
git clone https://github.com/sgolovine/nerdfont-patcher.git
cd nerdfont-patcher
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:fontforge/fontforge
sudo apt-get update -y
sudo apt-get install -y fontforge
fontforge -script font-patcher /PATH/TO/YOUR/FAVORITE/FONT/FontName.ttf -c
Install your new font and change your terminal font to the new font.
Just put "$(git-prompt)" anywhere inside of PS1.
export PS1="\u@\h \$(git-prompt)\[\e[00m\]\n\W\\$ "
My personal bash prompt.
export PS1="\[\e[92m\]\u@\h \$(git-prompt)\n\[\e[32;44m\] \W \[\e[0;34m\]\[\e[0m\]"
Just add these lines inside your .zshrc and you're set.
_prompt() {
git-prompt
}
autoload -U add-zsh-hook
add-zsh-hook precmd _prompt
My personal zsh prompt.
_prompt() {
if [[ -e `git rev-parse --git-dir 2> /dev/null` ]]; then
echo -n "$fg[green]`whoami`@`cat /proc/sys/kernel/hostname` "
else
echo "$fg[green]`whoami`@`cat /proc/sys/kernel/hostname`"
fi
git-prompt
}
autoload -U add-zsh-hook
add-zsh-hook precmd _prompt
autoload -U colors && colors
PROMPT="%{$fg[green]$bg[blue]%} %1d %{$reset_color%}%{$fg[blue]%}%{$reset_color%}"