LoginSignup
4
3

More than 3 years have passed since last update.

gitのエイリアス設定方法を端的にまとめた

Last updated at Posted at 2019-08-02

git コマンドのエイリアス(別名)に関する以下のコマンドをまとめました

  • エイリアスの設定
  • エイリアスの削除
  • エイリアスの一覧を見る

以降では、git statusgit st と打てるようにするエイリアスの設定として書いています。
適宜読み替えてください

マシン全体に反映

/etc/gitconfig に追記される

# 設定
$ git config --system alias.st status

# 削除
$ git config --system --unset alias.st

# 一覧
$ git config --system —-list | grep ^alias\.

ユーザに反映

~/.gitconfig に追記される。マシン設定より優先

# 設定
$ git config --global alias.st status

# 削除
$ git config --global --unset alias.st

# 一覧
$ git config --global --list | grep ^alias\.

リポジトリだけに反映

.git/config に追記される。ユーザ設定より優先

# 設定
$ git config alias.st status

# 削除
$ git config --unset alias.st

# 一覧
$ git config --list | grep ^alias\.
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