Abbreviated commit sha1 env variable?

What’s the best way to get an abbreviated git commit sha1 in your build environment using circle.yml?

Wanting the following:

git rev-parse --short HEAD
6bb413b

Cheers!

To get this you can add to circle.yml:

machine:
  environment:
    SHORT_GIT_HASH: $(echo $CIRCLE_SHA1 | cut -c -7)
1 Like

Perfect. Thanks @tom

This does not work in version 2.