By using git add -A
and git commit -a
, I can obviously add/commit all changes to the repo I'm currently situated in. However, is there a way to include all submodules in an add/commit and apply the same commit message to each?
You can use an alias. Make script: e.g. ~/supercommit.sh
#!/bin/bash -e
if [ -z $1 ]; then
echo "You need to provide a commit message"
exit
fi
git submodule foreach git add -A .
git submodule foreach git commit -am "$1"
git add -A .
git commit -am "$1"
And mark it executable (chmod +x
). Now, create an alias:
git config alias.supercommit '!~/supercommit.sh "$@"; #'
That should do (I'll test it in a bit)