CentOS - gitコマンドの入力補完(git-completion)、ローカルブランチの表示(git-prompt)
作業環境
SHELL> hostnamectl status Static hostname: localhost.localdomain Icon name: computer-vm Chassis: vm - Virtualization: kvm Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-693.21.1.el7.x86_64 Architecture: x86-64
SHELL> echo $SHELL /bin/bash
SHELL> git --version git version 1.8.3.1
git-completionの導入
gitコマンドの入力補完を導入するためにgit-completionを有効にします。 GitをYumでインストールした場合、以下ディレクトリにgit-completionはあるはず。
/usr/share/doc/git-1.8.3.1/contrib/completion/git-completion.bash
「~/.bash_profile」に以下、1行の設定を追記する
. /usr/share/doc/git-1.8.3.1/contrib/completion/git-completion.bash
設定の読み込み
SHELL> source ~/.bash_profile
ローカルブランチの表示
gitコマンドの入力補完を導入するためにgit-promptを有効にします。 GitをYumでインストールした場合、以下ディレクトリにgit-promptはあるはず。
/usr/share/doc/git-1.8.3.1/contrib/completion/git-prompt.sh
「~/.bash_profile」に以下、3行の設定を追記する
. /usr/share/doc/git-1.8.3.1/contrib/completion/git-prompt.sh GIT_PS1_SHOWDIRTYSTATE=true export PS1='[\[\033[1;32m\]\u\[\033[00m\]@\h \[\033[1;34m\]\w\[\033[1;31m\]$(__git_ps1)\[\033[00m\]]\$ '
設定の読み込み
SHELL> source ~/.bash_profile