Created
March 26, 2015 19:55
-
-
Save oldlastman/9bbc00eda11b3b30e446 to your computer and use it in GitHub Desktop.
Añadir rama actual de git al promt en ubuntu y salto de línea
This file contains hidden or 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
Editar archivo .bashrc en carpeta personal del usuario | |
1) forzar prompt coloreado. buscar y descomentar(quitar #): | |
force_color_prompt=yes | |
2) Incluir antes de unset color_prompt force_color_prompt el siguiente código para el prompt | |
# Add git branch if its present to PS1 | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]\n$(parse_git_branch)\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\n$(parse_git_branch)\$ ' | |
fi | |
texto original en: http://askubuntu.com/questions/145618/how-can-i-shorten-my-command-line-bash-prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment