LoginSignup
4
3

More than 5 years have passed since last update.

[初心者向け] gitでの開発環境を整える(git-prompt / git-completion)

Last updated at Posted at 2017-01-01

MacOSXにて。

git-completion

gitコマンドの補完を効かせてくれる代物

https://gyazo.com/ce5e1c2486084dca191b4e7cd4409010

導入手順

↑からスクリプトを持ってくる
.git-completion.bashとして任意の場所に保存(私はホームディレクトリにしてます)
macの場合であれば、.bash_profileに下記を追記

.bash_profile
source ~/.git-completion.bash

新規にターミナルを立ち上げるか

source ~/.bash_profile

これだけ、簡単!!

git-prompt

ターミナルにgitの現在開発しているブランチを表示してくれる代物。

https://gyazo.com/9cc665ec86e7920a67b24708ef71bad6

導入手順

↑からスクリプトを持ってくる
.git-prompt.shとして任意の場所に保存(私はホームディレクトリにしてます)
macの場合であれば、.bash_profileに下記を追記

.bash_profile
export PS1='[@\w\[\e[1;32m\]\[$(__git_ps1 " (%s)")\[\e[00m\]]\$'
source ~/.git-prompt.sh

あとは、git-completion同様

新規にターミナルを立ち上げるか

source ~/.bash_profile

で完了!

まとめ

簡単に導入できるし、gitでの開発者は導入しておいて損はないかと
git branch打つの面倒だし、branchが表示されてると安心感がありますね

ふらっと見た技術ブログにてgit-completionとgit-promptがないと
開発する気にならないと載っていたのですが調べてみてよかった。。

知らないことをちょろっと調べてみるのは大事ですね。。

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3