0

I have a list of commits and I want git-log(1) to show all of them. But only them.

1 Answer 1

0

You need --stdin which lets you provide options and commits from standard in as well as the one you’ve already provided. Keep in mind that it seems that this should be the last argument that you provide.

Then you need --no-walk which stops the command from finding ancestors.

$ cat example.txt
HEAD
HEAD~2
HEAD~5
$ <example.txt git log --no-walk --stdin

Example application:

ref=commits
[ "$(git notes --ref="$ref" | head -1)" ] \
    && git notes --ref="$ref" list \
    | cut -d' ' -f 2 \
    | git log --no-walk --ignore-missing --stdin
2
  • I wonder if git show is more like what you want instead of using all those log options.
    – eftshift0
    Commented 9 hours ago
  • @eftshift0 I don’t personally need git-show(1). But I can expand the QA to both commands. Thanks. Commented 8 hours ago

Not the answer you're looking for? Browse other questions tagged or ask your own question.