public function deploy($version)
    {

        // Checkout the branch
        $wrapper = new GitWrapper();
        $wrapper->streamOutput();
        $git = new GitWorkingCopy($wrapper, $this->getSourcePath());
        $git->checkout($version);
        $git->pull();

        // Reload config so any changes get picked up.
        $this->reloadConfig();

        // Run the deploy hooks, if there are any.
        if (isset($this->config['hooks']['deploy']) && !empty($this->config['hooks']['deploy'])) {
            chdir($this->getSourcePath());
            $process = new Process($this->config['hooks']['deploy']);
            $process->run(function ($type, $buffer) {
                if (Process::ERR === $type) {
                    // Error
                    echo $buffer;
                } else {
                    // OK
                    echo $buffer;
                }
            });
        }

        // @TODO: Save the environment
        // @TODO: Create EnvironmentFactory->save();
        // Returning the branch for now. The command is saving the info.
        return $this->getRepo()->getCurrentBranch();
    }