【git】gitをインストールした際に設定しておきたいこと
新しいPCにgitをインストールした際に、設定しておきたいことのメモです。
ユーザ名とメールアドレスの設定
$ git config --global user.name "ユーザ名" $ git config --global user.email "メールアドレス"
カラーの設定
$ git config --global color.ui auto
エイリアスの設定
$ git config --global alias.co checkout $ git config --global alias.ci commit $ git config --global alias.st status $ git config --global alias.br branch
設定項目の確認
$ git config -l
Macのターミナルにブランチ名を表示する方法
※参考サイト http://j-caw.co.jp/blog/?p=901
- git-prompt.shをホームディレクトリへ。(gitをhomebrewで入れている場合)
cp /usr/local/Cellar/git/1.8.4/etc/bash_completion.d/git-prompt.sh ~/.git-prompt.sh
- .bashrcに追記
source ~/.git-prompt.sh GIT_PS1_SHOWDIRTYSTATE=true PS1='[\u@\h \W]$(__git_ps1 "[\[\033[32m\]%s\[\033[0m\]]")\$ '
$ source ~/.bashrc
常にブランチ名が表示されてるのは便利です。 ブランチ名が表示されていると「ブランチ間違えてた」って凡ミス減るかと思います。