Created
May 9, 2017 01:36
-
-
Save shout-poor/35006492f1c1b81a7502c02cada9262a to your computer and use it in GitHub Desktop.
Install git-completion & git prompt (for bash)
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
#!/bin/bash | |
# | |
# git-completion & git-prompt を導入するスクリプト(for bash) | |
# git, curl, unzip を事前にインストールしておくこと | |
# | |
set -eux | |
set -o pipefail | |
TEMPDIR=$(mktemp -d) | |
cd $TEMPDIR | |
curl -LsS https://github.com/git/git/archive/master.zip -o git-master.zip | |
unzip git-master.zip | |
cp git-master/contrib/completion/git-completion.bash $HOME/.git-completion.bash | |
cp git-master/contrib/completion/git-prompt.sh $HOME/.git-prompt.sh | |
cd $HOME | |
chmod +x .git-completion.bash | |
chmod +x .git-prompt.sh | |
cat << 'EOT' >> $HOME/.bashrc | |
source $HOME/.git-completion.bash | |
source $HOME/.git-prompt.sh | |
GIT_PS1_SHOWDIRTYSTATE=1 | |
GIT_PS1_SHOWUPSTREAM=1 | |
GIT_PS1_SHOWUNTRACKEDFILES=1 | |
GIT_PS1_SHOWSTASHSTATE=1 | |
export PS1='\[\033[1;32m\]\u\[\033[00m\]:\[\033[1;34m\]\w\[\033[1;31m\]$(__git_ps1)\[\033[00m\]\n\$ ' | |
EOT | |
if [ -d "$TEMPDIR" ]; then | |
rm -r "$TEMPDIR" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment