Refactor method to retrieve git reference.