gitのエイリアスを設定する
適用レベル
設定レベルが大きい方が優先度が高い。
オプション | 範囲 | 設定レベル |
---|---|---|
無し | リポジトリ固有 | 3 |
--global | Gitユーザー固有 | 2 |
--system | マシン全体 | 1 |
「git」コマンド自体を省略する
「git」というコマンドを「g」にする。
$ alias g='git'
エイリアスの設定方法
方法1: .gitconfigに追記する
~/.gitconfigを直で開く
$ git config --global --edit
以下のように追記していく
[alias] s = status ss = status -s co = checkout
方法2: git config --globalで設定する
git config [option] alias.短縮形 展開形
でエイリアスを設定。
$ git config --global alias.st status $ git config --global alias.co checkout $ git config --global alias.br branch $ git config --global alias.cm commit $ git config --global alias.df diff $ git config --global alias.gr grep
確認方法
エイリアスに設定したものを確認する。
$ git config --global --list | grep ^alias\.