エイリアス貼りましょう。
.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と一緒にしてしまってもいいような気もしますが、そこはお好みで。