Skip to content

Instantly share code, notes, and snippets.

@massongit
Last active September 18, 2018 09:32
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 massongit/40620659e72f8c87ef734323443fe706 to your computer and use it in GitHub Desktop.
Save massongit/40620659e72f8c87ef734323443fe706 to your computer and use it in GitHub Desktop.
UbuntuのCLI上でGitを快適に使えるようにする方法 ( https://qiita.com/SUZUKI_Masaya/items/5abe232fa85d11ee89ea )
--- .bashrc 2018-05-27 11:00:45.318699382 +0900
+++ .bashrc_ 2018-05-27 10:55:21.144009944 +0900
@@ -56,11 +56,22 @@
fi
fi
+# スクリプト読み込み
+source ~/.git_completion/contrib/completion/git-completion.bash
+source ~/.git_completion/contrib/completion/git-prompt.sh
+
+# CLIでのGitの状態の表示設定
+export GIT_PS1_SHOWDIRTYSTATE=1
+export GIT_PS1_SHOWUPSTREAM=1
+export GIT_PS1_SHOWUNTRACKEDFILES=1
+export GIT_PS1_SHOWSTASHSTATE=1
+
if [ "$color_prompt" = yes ]; then
- PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+ PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]'
else
- PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
+ PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w'
fi
+
+PS1="$PS1\[\033[1;31m\]\$(__git_ps1)\[\033[00m\]\$ "
+
unset color_prompt force_color_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment