gitgit-cherry

Git cherry combined with git show


I am using Git cherry and would like to see more detail about the commits it finds. First I run

git cherry
-- read the output
git show sha-1

Is there a way to see the commit/log/diffs for all the results of cherry, and page through them? I've tried piping the results of git cherry to various things but cant seem to find one that works.


Solution

  • I do not have a "complete" answer, but these quick hacks may be helpful:

    $ git cherry master
    + c3f6a19ac55170baa33fbbfb583ff3f0d4ad2710
    + 8b73d6cb31d0a3fed328acd31d524a671238f51a
    $ git cherry -v master
    + c3f6a19ac55170baa33fbbfb583ff3f0d4ad2710 Add "foo" command
    + 8b73d6cb31d0a3fed328acd31d524a671238f51a Add "--bar" argument
    $ git cherry master | awk '{ system("git show $2"); }'
    [ interactive "git show" calls happen here ]
    $
    

    Remaining issues are

    1. You do not see whether the "git show"n thing is actually prefixed with a +.
    2. You have no way from within the "git show" to abort the whole operation.
    3. You have no way from within the "git show" to know whether the shown commit is 1/100, 1/2, or 88/100.