コミットユーザ名を設定する

git config --global user.name [UserName]

コミットユーザ名を設定する

git config --global user.email [Email]

コミット時等に使用するエディタを設定する

# vim(Linux,mac)
git config --global core.editor "vim -c 'set fenc=utf-8'"

# Sublime(Liux,mac)
# subl コマンドが登録できていない場合は以下も実行(mac)
# "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" "/usr/local/bin/subl"
git config --global core.editor "subl -w"

# Sublime(windows)
git config --global core.editor "'C:/Program Files/Sublime Text 3/sublime_text.exe' -w"

git の標準出力をカラーリングする

git config --global color.ui auto

git push 時の宛先省略時のデフォルト動作設定

simple: カレントブランチに追跡ブランチが設定されている、
かつローカルとリモートのブランチ名が同じである場合に、追跡ブランチに対して push する。

git config --global push.default simple

日本語ファイルの文字化け対応

git config --global core.quotepath false

現在のブランチのトラッキング先を設定する

git branch --set-upstream-to=origin/master

git コマンドのエイリアス設定

git config --global alias.co checkout
git config --global alias.cm commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
git config --global alias.lga "log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"

Git差分のあるファイルをSCP転送する

git status --short |awk '{print substr($0, 4, length($0) - 3)}' |xargs -I 'send_file_path' scp send_file_path server:/対象ディレクトリ/send_file_path