0
0

More than 3 years have passed since last update.

毎回 git commit -m "" と打つのが億劫なので、シェル関数でショートカットを作成した

Last updated at Posted at 2021-03-08

~/.zshrcに、1行追加するだけ。

~/.zshrc
function gm() { git commit -m "$*" }

以上。

使用方法

追加/反映してくれるコマンドをターミナルに打ち込む。

echo 'function gm() { git commit -m "$*" }' >> ~/.zshrc
source ~/.zshrc
(Gitリポジトリに移動、適宜編集、git addする。)
gm feat: commit msg

追加情報

公式ドキュメント/参考文献

http://zsh.sourceforge.net/Intro/intro_4.html
https://linuxjm.osdn.jp/html/GNU_bash/man1/bash.1.html

実行環境

MacBook Air (M1, 2020) 11.2.2(20D80)
zsh 5.8 (x86_64-apple-darwin20.0)

その他

  1. 誤り/提案等がありましたら、ぜひコメント等頂けますと嬉しいです。
  2. gm 部分は関数名=呼び出す際に打つコマンドとなりますので、お好みでご変更ください。
0
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
0
0