git-subsum is a more concise but descriptive way to summarize the changes in your submodules, specially suitable to include in commit messages.
The basic usage is just git subsum
. You can also specify a reference, like
git subsum HEAD^
to see what changed in the last commit.
It always try to use descriptive names for references (tag names with the number
of extra commits in a style similar to git describe
) and by default it will
only print the first 5 commit messages for a submodule.
The option -c
will only print changes in the index (or staging area), is
similar to the --cached
option for git submodule summary
.
The options -m
and -n
can be used to change the default maximum and minimum
number of commits to print (respectively). If the minimum is negative, the
maximum is used as minimum, which is the default. Otherwise, if a minimum is
set, then if there are more commits to show than the maximum, only the minimum
value is printed.
For example -m 5 -n 2
will printed:
* submodule v1.17.0+8(7618cac)...v1.18.0+6(f97f271) (58 commits)
> Some change
> Some other change
(...)
But if -m 5 -n -1
is used (which is the default), this will be printed:
* submodule v1.17.0+8(7618cac)...v1.18.0+6(f97f271) (58 commits)
> Some change
> Some other change
> Change 3
> Change 4
> Change 5
(...)
The -m
and -n
parameters can be also configured in a per-repository or
global/system fashion by using the git config
variables subsum.max
and
subsum.min
respectively.
There is also a prepare-commit-msg
hook script available. If you copy this
file to the .git/hooks/
directory, then the output of git subsum
will be
automatically added (and updated) when you commit something.
If you installed the Debian package, this is enabled by default for new
repositories you created. If you want the old repositories to be updated, you
have to go to the repository directory and run git init
again.