def remove_data(self, index: git.IndexFile, path: str): fullpath = os.path.join(os.path.dirname(index.repo.git_dir), path) pathlib.Path(fullpath).parent.mkdir(parents=True, exist_ok=True) index.remove([fullpath], working_tree=True)