code: def get_upstream_index_sha(repo: "git.Repo") -> Optional[str]:
      upstream_commit = get_relevant_upstream_commit(repo)
  
      if upstream_commit and upstream_commit != repo.head.commit:
          return upstream_commit.hexsha
  
file_path: neptune-client/src/neptune/internal/utils/git.py
imports: import logging
  import warnings
  from dataclasses import dataclass
  from datetime import datetime
  from typing import TYPE_CHECKING, List, Optional, Union
  from neptune.attributes.constants import DIFF_HEAD_INDEX_PATH, UPSTREAM_INDEX_DIFF
  from neptune.types import File
  from neptune.types.atoms.git_ref import GitRef, GitRefDisabled
label_desc: Use image node_id 7 for calling a global function with example usage: get_upstream_index_sha(repo) and returns: upstream_commit