def METHOD_NAME(display_error):
    # Deinit fails if no submodules, so ignore its failure
    self._run_git(['-c', 'protocol.file.allow=always',
                   'submodule', 'deinit', '-f', '.'],
                  cwd=path, display_error=False, valid_return_codes=None)
    self._run_git(['checkout', '-f', commit_hash],
                  cwd=path, display_error=display_error)
    self._run_git(['clean', '-fdx'],
                  cwd=path, display_error=display_error)
    self._run_git(['-c', 'protocol.file.allow=always',
                   'submodule', 'update', '--init', '--recursive'],
                  cwd=path, display_error=display_error)