LoginSignup
2
1

More than 3 years have passed since last update.

gitコマンドをカスタマイズ。

Posted at

とりあえず、gitの設定を見てみましょう。

$ git config -l
~
alias.s=status
alias.a=!git add . && git status
alias.au=!git add -u . && git status
alias.aa=!git add . && git add -u . && git status
alias.c=commit
alias.cm=commit -m
alias.ca=commit --amend
alias.ac=!git add . && git commit
alias.acm=!git add . && git commit -m
~

 
alias:エイリアスとは、置き換え、別名という意味。
例えば、一番下 "alias.acm=!git add . && git commit -m" の設定により、

$git add . && git commit -m
$git acm // 同義

で呼び出せるようになります。これは楽チンだ。

自分で設定したい

新しいパラメータを設定・既存のパラメータを修正するには

$git config [パラメータ] [値]

が使えます。例えば、checkoutって打ちづらいなと最近よく思うので、

$git config alias.ch checkout // -> alias.ch=checkout を追加

//これにより以下でチェックアウトできる
$git ch [ブランチ名]

いいぞ、alias。

2
1
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
2
1