Better solution to getting the appropriate branch SHA.