class_docstr: TODO: Reimplement functions with robust library: https://github.com/gitpython-developers/GitPython
  
  This CodeDriver manages source control management for the project using git
class_docstr_tok: ["TODO",":","Reimplement","functions","with","robust","library",":","https",":","\/\/github.com\/gitpython-developers\/GitPython","This","CodeDriver","manages","source","control","management","for","the","project","using","git"]
code: def __init__(self, filepath, execpath, remote_url=None):
      super(GitCodeDriver, self).__init__()
      self.filepath = filepath
      # Check if filepath exists
      if not os.path.exists(self.filepath):
          raise PathDoesNotExist(
              __(
                  "error",
                  "controller.code.driver.git.__init__.dne",
                  filepath,
              )
          )
      self.execpath = execpath
      # Check the execpath and the version
      try:
          p = subprocess.Popen(
              [self.execpath, "version"],
              stdout=subprocess.PIPE,
              stderr=subprocess.PIPE,
              cwd=self.filepath,
          )
          out, err = p.communicate()
          out, err = out.decode(), err.decode()
          if err:
              raise GitExecutionError(
                  __(
                      "error",
                      "controller.code.driver.git.__init__.giterror",
                      err,
                  )
              )
          version = str(out.split()[2].split(".windows")[0])
          if not semver.match(version, ">=1.9.7"):
              raise GitExecutionError(
                  __(
                      "error",
                      "controller.code.driver.git.__init__.gitversion",
                      out.split()[2],
                  )
              )
      except Exception as e:
          raise GitExecutionError(
              __(
                  "error",
                  "controller.code.driver.git.__init__.giterror",
                  str(e),
              )
          )
  
      # TODO: handle multiple remote urls
      # self.git_host_driver = GitHostDriver()
      self.remote_url = remote_url
  
      self._is_initialized = self.is_initialized
  
      if self._is_initialized:
          # If initialized ensure .datmo is not in working tree else error
          if self.exists_datmo_files_in_worktree():
              raise DatmoFolderInWorkTree(
                  __(
                      "error",
                      "controller.code.driver.git.__init__.datmo",
                  )
              )
          # If initialized ensure .datmo is ignored (in .git/info/exclude)
          self.ensure_datmo_files_ignored()
          # If initialized update remote information
          # if remote_url:
          #     self.remote("set-url", "origin", remote_url)
          # self._remote_url = self.remote_url
          # self._remote_access = False
      self.type = "git"
  
imports: import os
  import shutil
  import subprocess
  import semver
  from io import open
  from giturlparse import parse
  from datmo.core.util.i18n import get
  from datmo.core.util.exceptions import PathDoesNotExist, GitUrlArgumentError, GitExecutionError, FileIOError, CommitDoesNotExist, CommitFailed, DatmoFolderInWorkTree, UnstagedChanges
  from datmo.core.controller.code.driver import CodeDriver
  from datmo.config import Config
label_desc: Use image node_id 1 to create a new GitCodeDriver object from inherited base classes: CodeDriver with example: obj = GitCodeDriver(filepath, execpath, remote_url)