LoginSignup
9
9

More than 5 years have passed since last update.

git submodule update がいちいち面倒くさいあなたへ

Posted at

エイリアス貼りましょう。
.zshrcへ、

alias gsu='cd $(git rev-parse --show-toplevel) && git submodule update && cd -'

を追記。
gsuと叩けば一発でsubmodule updateします。

エイリアスなのでgsuの部分はお好きな文字列で良いです。
.zshrc編集したらsourceで読み込むのを忘れずに。


作った経緯

「あーそろそろmasterブランチ追跡しないとー」

git pull 
git status

## master
 M ../sub/module

イラッ
「あーはいはいsubmodule updateね」

git submodule update

You need to run this command from the toplevel of the working tree.

イライライラッ
なんでいちいちthe toplevel of the working treeとやらまで行かなあかんねん!めんどい!
the toplevel of the working tree行ってgit submodule updateして今おるとこへ戻ってこい!

というエイリアスを作っただけです。
そもそもgit pullと一緒にしてしまってもいいような気もしますが、そこはお好みで。

9
9
1

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