How can I find all the commits that have a given commit as parent?
For instance, if I have this Git commit graph,
G H I J
\ / \ /
D E F
\ | / \
\ | / |
\|/ |
B C
\ /
\ /
A
I'd like to get a list of all the direct descendants of B
: D
, E
and F
.
You can use git
rev-list --parents
and filter the children of a parent withgrep
andawk
Replace
<PARENT_SHA1>
with the sha-1 hash of yourB
commit.EDIT
Thanks shadowtalker. Here is the command line that works using just awk:
It's a bit shorter and one less process for the shell.