protected function mergeFile(string $file, string $base, string $remote, string $local) : string
    {
        file_put_contents($file, $base);
        $this->git->add($file);
        $this->git->commit('Add base.');

        if (!in_array('original', $this->git->getBranches()->all())) {
            $this->git->checkoutNewBranch('original');
        } else {
            $this->git->checkout('original');
            $this->git->rebase('master');
        }

        file_put_contents($file, $remote);
        $this->git->add($file);
        $this->git->commit('Add remote.');

        $this->git->checkout('master');

        file_put_contents($file, $local);
        $this->git->add($file);
        $this->git->commit('Add local.');

        $this->git->merge('original');
        return file_get_contents($file);
    }
protected function mergeFile(string $file, string $base, string $remote, string $local) : string
    {
        file_put_contents($file, $base);
        $this->git->add($file);
        $this->git->commit('Add base.');

        if (!in_array('original', $this->git->getBranches()->all())) {
            $this->git->checkoutNewBranch('original');
        } else {
            $this->git->checkout('original');
            $this->git->rebase('master');
        }

        file_put_contents($file, $remote);
        $this->git->add($file);
        $this->git->commit('Add remote.');

        $this->git->checkout('master');

        file_put_contents($file, $local);
        $this->git->add($file);
        $this->git->commit('Add local.');

        $this->git->merge('original');
        return file_get_contents($file);
    }
protected function mergeFile ( string $ file , string $ base , string $ remote , string $ local ) : string { file_put_contents ( $ file , $ base ) ; $ this -> git -> add ( $ file ) ; $ this -> git -> commit ( 'Add base.' ) ; if ( ! in_array ( 'original' , $ this -> git -> getBranches ( ) -> all ( ) ) ) { $ this -> git -> checkoutNewBranch ( 'original' ) ; } else { $ this -> git -> checkout ( 'original' ) ; $ this -> git -> rebase ( 'master' ) ; } file_put_contents ( $ file , $ remote ) ; $ this -> git -> add ( $ file ) ; $ this -> git -> commit ( 'Add remote.' ) ; $ this -> git -> checkout ( 'master' ) ; file_put_contents ( $ file , $ local ) ; $ this -> git -> add ( $ file ) ; $ this -> git -> commit ( 'Add local.' ) ; $ this -> git -> merge ( 'original' ) ; return file_get_contents ( $ file ) ; }
Merge three strings in a specified file.

@param string $file
The file name in the git repository to which the content is written.
@param string $base
The common base text.
@param string $remote
The first changed text.
@param string $local
The second changed text

@return string
The merged text.
Merge three strings in a specified file .