git rev-list
can show children, but these children have to be reachable from the commits you provide. Assuming you want to show all children reachable from all branches in your repo, you can use something like
git rev-list --all --not $COMMIT^@ --children | grep "^$COMMIT"
This should output a line that looks like
$COMMIT $child1 $child2 $child3 ...
For convenience, you can add turn the command into a git alias by adding the following line to the [alias] section of your ~/.gitconfig:
children = "!f() { git rev-list --all --not $1^@ --children | grep $(git rev-parse $1); }; f" # reachable children of a ref
The syntax $COMMIT^@
might be confusing, so I'll explain it. Hopefully $COMMIT
is self-explanatory. This is then followed by ^@
, which expands to all parents of the referenced commit. So $COMMIT^@
means "all parents of $COMMIT
". Since this follows the --not
flag, this instructs rev-list
to stop processing after it hits any parent of $COMMIT
. This is basically just an optimization, because any commit reachable from $COMMIT
cannot possibly be a child.
Note: a previous version of this answer said tail -1
instead of grep "^$COMMIT"
. This may work in a simple test repo (which is why I initially said it), but there's no guarantee that git rev-list will emit $COMMIT
last, if you have any branches that do not contain $COMMIT
.