LoginSignup
1
1

More than 5 years have passed since last update.

コマンド一発でGithubにPushしたい

Posted at

タイトルの通りです。
いつも発行している

git push origin branchName

をコマンド一発でやりたいと思って作成しました。

bash_profileの編集

bash_profileに以下を追加します。
まずviで編集します

command
$ vi ~/.bash_profile

これを追加します。

bash_profile
alias mygitpush="git branch |grep \"* \"|awk '{if (\$2 != \"develop\" && \$2 != \"master\") {print \$2 } else {print \"Carefull!! This branch is develop or master!!!\"; exit } }'| xargs git push origin "

再読み込み

追加したら、再読み込みします。

command
$ source ~/.bash_profile

実行

gitのワークスペース内で以下を実行したらmaster,developのブランチ以外でpushできます。

command
$ mygitpush

という怠けようコマンドでした。

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