code: def _getCleanupCommand(self):
          
          return textwrap.dedent("""\
              set -v
              if [ -d .repo/manifests ]
              then
                  # repo just refuse to run if manifest is messed up
                  # so ensure we are in a known state
                  cd .repo/manifests
                  rm -f .git/index.lock
                  git fetch origin
                  git reset --hard remotes/origin/%(manifestBranch)s
                  git config branch.default.merge %(manifestBranch)s
                  cd ..
                  ln -sf manifests/%(manifestFile)s manifest.xml
                  cd ..
               fi
               repo forall -c rm -f .git/index.lock
               repo forall -c git clean -f -d -x 2>/dev/null
               repo forall -c git reset --hard HEAD 2>/dev/null
               rm -f %(workdir)s/.repo/project.list
               """) % dict(manifestBranch=self.manifestBranch,
                           manifestFile=self.manifestFile,
                           workdir=self.workdir)
docs: also used by tests for expectations