Get abbrev-commit for a git branch, cleanly
I need to extract abbreviated commit names for specific git branches. These are typically 7-digit hexadecimal numbers, and they're used by some systems (including Heroku's COMMIT_HASH environment variable) to identify a specific commit.

There's several ugly ways to get an abbreviated commit name, including:

    $ git log -1 --oneline | awk '{ print $1 }'
    d4377e3
    $ git describe --always --match ''
    d4377e3

Is there a cleaner way to get this value?

Get abbrev-commit for a git branch, cleanly
===

I need to extract abbreviated commit names for specific git branches. These are typically 7-digit hexadecimal numbers, and they're used by some systems (including Heroku's COMMIT_HASH environment variable) to identify a specific commit.

There's several ugly ways to get an abbreviated commit name, including:

    $ git log -1 --oneline | awk '{ print $1 }'
    d4377e3
    $ git describe --always --match ''
    d4377e3

Is there a cleaner way to get this value?
