Exclude Preceding Commit> line from git rev-list formatting

There is literally no way to do this, unfortunately. git rev-list is implemented thusly:

    if (revs->abbrev_commit && revs->abbrev)
        fputs(find_unique_abbrev(&commit->object.oid, revs->abbrev),
              stdout);
    else
        fputs(oid_to_hex(&commit->object.oid), stdout);

so no matter what options you put in, git rev-list will always print some kind of commit hash.


To leave an answer for those who will come next/

@torec mentioned in his comment the following:

git rev-list and git log are essentially the same command

The answer is to use the following format:

# print out the log history in the desired format.
git log --pretty="format:..." <SHA-1>

You can use sed after git rev-list to delete all the lines starting with commit.

git rev-list --pretty=format:"%C(yellow)%h%C(reset) %s" | sed '/^commit [0-9a-f]\{40\}$/d'.

Tags:

Git