app\components\Git::updateToVersion PHP Method

updateToVersion() public method

更新到指定commit版本
public updateToVersion ( Task $task ) : boolean
$task app\models\Task
return boolean
    public function updateToVersion(TaskModel $task)
    {
        // 先更新
        $destination = Project::getDeployWorkspace($task->link_id);
        $this->updateRepo($task->branch, $destination);
        $cmd[] = sprintf('cd %s ', $destination);
        $cmd[] = sprintf('/usr/bin/env git reset -q --hard %s', $task->commit_id);
        $command = join(' && ', $cmd);
        return $this->runLocalCommand($command);
    }