public function merge(Branch $branch, string $message = '', string $mode = 'auto')
    {
        $valid_modes = [
            'auto', // deafult git behavior
            'ff-only', // force fast forward merge
            'no-ff', // force 3-way merge
        ];
        if (!in_array($mode, $valid_modes)) {
            throw new InvalidArgumentException("Invalid merge mode: $mode.");
        }

        $options = [];
        switch ($mode) {
            case 'ff-only':
                $options[] = MergeCommand::MERGE_OPTION_FF_ONLY;
                break;
            case 'no-ff':
                $options[] = MergeCommand::MERGE_OPTION_NO_FF;
                break;
        }

        $this->caller->execute(MergeCommand::getInstance($this)->merge($branch, $message, $options));

        return $this;
    }
public function merge(Branch $branch, string $message = '', string $mode = 'auto')
    {
        $valid_modes = [
            'auto', // deafult git behavior
            'ff-only', // force fast forward merge
            'no-ff', // force 3-way merge
        ];
        if (!in_array($mode, $valid_modes)) {
            throw new InvalidArgumentException("Invalid merge mode: $mode.");
        }

        $options = [];
        switch ($mode) {
            case 'ff-only':
                $options[] = MergeCommand::MERGE_OPTION_FF_ONLY;
                break;
            case 'no-ff':
                $options[] = MergeCommand::MERGE_OPTION_NO_FF;
                break;
        }

        $this->caller->execute(MergeCommand::getInstance($this)->merge($branch, $message, $options));

        return $this;
    }
public function merge ( Branch $ branch , string $ message = '' , string $ mode = 'auto' ) { $ valid_modes = [ 'auto' , // deafult git behavior 'ff-only' , // force fast forward merge 'no-ff' , // force 3-way merge ] ; if ( ! in_array ( $ mode , $ valid_modes ) ) { throw new InvalidArgumentException ( "Invalid merge mode: $mode." ) ; } $ options = [ ] ; switch ( $ mode ) { case 'ff-only' : $ options [ ] = MergeCommand :: MERGE_OPTION_FF_ONLY ; break ; case 'no-ff' : $ options [ ] = MergeCommand :: MERGE_OPTION_NO_FF ; break ; } $ this -> caller -> execute ( MergeCommand :: getInstance ( $ this ) -> merge ( $ branch , $ message , $ options ) ) ; return $ this ; }
Merge a Branch in the current checked out branch

@param Objects\Branch $branch  The branch to merge in the current checked out branch
@param string         $message The message for the merge commit, if merge is 3-way
@param string         $mode    The merge mode: ff-only, no-ff or auto

@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository
Merge a Branch in the current checked out branch