Use existing methods for branch names: Ex use @repository.branch_names instead of @repository.heads.map(&:name)