LoginSignup
1
0

More than 5 years have passed since last update.

gitのエイリアスを作るときに使ったtips - mac

Posted at

gitでよく使うコマンドをエイリアスにしたかったので、その時に、色々方法があるんだろうけど自分流で、他のは調べずにw 作ってみました。シェルスクリプトで。条件は、引数が使えること。ちなみに私の環境はmacです。unixのコマンドを使っていきます。

まずはbash_profileにエイリアスを書いていきます。

vi ~/.bash_profile

例えば下記のようにエイリアスを書いたとします

function tes(){
git add . -A
git commit -m "commmon commit"
git push $1 $2
}

んで、ファイルを更新

source ~/.bash_profile

んで、下記のようにコマンドを打つと、git push origin masterで、やってくれます。

$ tes origin master

シェルスクリプトは引数名を作れないので$1 $2とかのようになってしまいます。

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