Skip to content

Instantly share code, notes, and snippets.

@juangiordana
Last active August 15, 2020 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juangiordana/7c6802303962d35a1cfbb042f8276914 to your computer and use it in GitHub Desktop.
Save juangiordana/7c6802303962d35a1cfbb042f8276914 to your computer and use it in GitHub Desktop.
Colored Git prompt for Homestead box.
# https://unix.stackexchange.com/questions/124407/what-color-codes-can-i-use-in-my-ps1-prompt
PS1='${debian_chroot:+($debian_chroot)}\[\033[38;5;214m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\] \$\[\033[00m\] '
@juangiordana
Copy link
Author

If you want this in your Homestead box, add the following code snippet to your user-customizations.sh file and re-provision the Homestead machine using the vagrant reload --provision command.

# ~/Homestead/user-customizations.sh

# Git prompt.
if [ ! -f ~/.config/git/git-prompt.sh ]; then
    mkdir -p ~/.config/git
    curl -s https://gist.githubusercontent.com/juangiordana/7c6802303962d35a1cfbb042f8276914/raw/21f169aff08b3aadae95b7a303b414ffccd8c00d/git-prompt-homestead.sh \
        -o ~/.config/git/git-prompt.sh

    cat >> ~/.bashrc << EOF

# Git prompt.
if [ -f ~/.config/git/git-prompt.sh ]; then
    . ~/.config/git/git-prompt.sh
fi

EOF
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment