If you are trying to get all parents and using the revision parameter syntax, you can try using the log subcommand with --no-walk .
An example if we have the following:
$ git --oneline --graph * A |\ | * B | * C | * D * | E
In this example, I use ^@ to get all parents and the --no-walk option to show only parents, not their ancestors.
$ git log --no-walk A^@ commit B ........ commit E ........
For more information on the revision parameter, open git rev-parse .
source share