Quick & Dirty Way Of Notifying Everyone When Code Deploys
Cory Kennedy-Darby
61

FYI, the code above only looks at the currently checked out branch (i.e. PWD of git repo).

If you want a specific branch info, you can look at other than currently checked out branch.

GIT_BRANCH=”refs/heads/release” 
GIT_BRANCH_HASH=”$(cat $GIT_BRANCH)”

SLACK_MESSAGE=”$( git show -1 $GIT_BRANCH_HASH -s )”

You can view list of branches by:

$ git branch -a -v

or 
$ grep -r . refs
refs/heads/release:ab5b7e8a25f81f79437986h570be1f3dcf7fa6c4
refs/heads/feature/123-blue:7679f604f080af07h423e7a5f79b8a198cbeb01f
refs/heads/feature/456-red:53497ca5e041fc6dc6h26f0f2a00ff08eb072003
refs/heads/master:fed28cf5bcf1cc90a76e310965h1d05479bb0e64
refs/heads/develop:25289ab2bb8b06a1fc73dc9he46cfe4911c76af9
refs/tags/RC4:408f81f1803116f1d889bf90dh36faf215a7ae44

Show your support

Clapping shows how much you appreciated Iain Davidson’s story.