protected function runGitInitAdd()
    {
        $repo = $this->gitRepo();
        $origin = $this->gitOrigin();
        $branch = $this->gitBranch();

        $stack = $this->getGitBuildStack();
        if (!$this->buildHasGit()) {
            $stack
                ->exec('init')
                ->exec("remote add {$origin} {$repo}");

            if ($this->gitRemoteBranchExist()) {
                $stack
                    ->exec('fetch --all')
                    ->exec("reset --soft {$origin}/{$branch}");
            }
        } else {
            $stack
                ->checkout($branch)
                ->pull($origin, $branch);
        }
        $result = $stack
            ->add('.')
            ->run();

        $this->validateTaskResult($result);

        return $this;
    }