Physical themes Magento changes to virtual theme when you change branch on git

Physical themes Magento changes to virtual theme when you change branch on git
it is at 1 on the database it should be set to 0.

    /**
 * Checks all physical themes that they were not deleted
 *
 * @return $this
 */
public function checkPhysicalThemes()
{
    $themes = $this->_collectionFactory->create()->addTypeFilter(ThemeInterface::TYPE_PHYSICAL);
    /** @var $theme ThemeInterface */
    foreach ($themes as $theme) {
        if (!$this->_themeCollection->hasTheme($theme)) {
            $theme->setType(ThemeInterface::TYPE_VIRTUAL)->save();
        }
    }
    return $this;
}