Last active
April 17, 2024 10:04
-
-
Save tdd/473838 to your computer and use it in GitHub Desktop.
Config Bash pour un prompt Git de tueur
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# STEP 1: ENSURE COMPLETION AND PROMPT FUNCTION ARE LOADED | |
# ======================================================== | |
# OPTION 1: If on OSX using Homebrew: | |
# | |
# source $(brew --prefix)/etc/bash_completion.d/git-prompt.sh | |
# source $(brew --prefix)/etc/bash_completion.d/git-completion.bash | |
# OPTION 2: If on OSX using built-in Git (also works on ZSH): | |
# | |
# source /usr/local/git/contrib/completion/git-prompt.sh | |
# source /usr/local/git/contrib/completion/git-completion.bash | |
# OPTION 3: If on Ubuntu/Debian/Mint using standard packages, or on Windows: pre-loaded! | |
# STEP 2: CONFIGURE THE PROMPT | |
# ============================ | |
# Configure `__git_ps1` to tell us as much as possible | |
export GIT_PS1_SHOWDIRTYSTATE=1 GIT_PS1_SHOWSTASHSTATE=1 GIT_PS1_SHOWUNTRACKEDFILES=1 | |
export GIT_PS1_SHOWUPSTREAM=verbose GIT_PS1_DESCRIBE_STYLE=branch GIT_PS1_SHOWCOLORHINTS=1 | |
export GIT_PS1_HIDE_IF_PWD_IGNORED=1 | |
# Colorful prompt for Bash! | |
export PS1='\[\e[0;36m\][\A] \u@\h:\[\e[0m\e[0;32m\]\W\[\e[1;33m\]$(__git_ps1 " (%s)")\[\e[0;37m\] \$\[\e[0m\] ' | |
# Or if you want the basic prompt, no colors, no timestamps, just regular + Git info: | |
# export PS1='\u@\h:\W$(__git_ps1 " (%s)")\$ ' | |
# Unrelated but useful: avoid auto-édit on successful merges, starting with Git 2.0 | |
export GIT_MERGE_AUTOEDIT=no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Si on a installé git avec Homebrew et que l'on veut lancer git-completion.bash et git-prompt.sh, on peut écrire
pour expliciter les choses, même si ça revient dans la plupart des configurations à
Viser une version en particulier est problématique après upgrade et cleanup…