def rename(self, new_path: PathLike, force: bool = False) -> "Head":
        """Rename self to a new path.

        :param new_path:
            Either a simple name or a path, e.g. ``new_name`` or ``features/new_name``.
            The prefix ``refs/heads`` is implied.

        :param force:
            If ``True``, the rename will succeed even if a head with the target name
            already exists.

        :return:
            self

        :note:
            Respects the ref log, as git commands are used.
        """
        flag = "-m"
        if force:
            flag = "-M"

        self.repo.git.branch(flag, self, new_path)
        self.path = "%s/%s" % (self._common_path_default, new_path)
        return self
Rename self to a new path.

        :param new_path:
            Either a simple name or a path, e.g. ``new_name`` or ``features/new_name``.
            The prefix ``refs/heads`` is implied.

        :param force:
            If ``True``, the rename will succeed even if a head with the target name
            already exists.

        :return:
            self

        :note:
            Respects the ref log, as git commands are used.
        
git/refs/head.py