steveukx / git-js

A light weight interface for running git commands in any node.js application.
MIT License
3.42k stars 313 forks source link

.mergeFromTo doing octopus merge instead of expected merge #1003

Closed omixximo closed 2 days ago

omixximo commented 3 weeks ago

Hello,

I was trying to use the command mergeFromTo to merge a branch allocated in a remote.

Example: origin/branchToMerge

Reading the documentation of the method I can see that:

/**
    * Merges from one branch to another, equivalent to running `git merge ${remote} ${branch}`, the `options` argument can
    * either be an array of additional parameters to pass to the command or null / omitted to be ignored.
    */
   mergeFromTo<E extends GitError>(
     remote: string,
      branch: string,
      options?: types.TaskOptions,
      callback?: types.SimpleGitTaskCallback<resp.MergeResult, E>
   )

So I would call the method like git.mergeFromTo('origin', 'branchToMerge').

This is executing: 'git merge origin branchToMerge'. This is tries an octupus merge instead of a normal merge by documentation at least from version 2.33 or higher: git-merge doc 2.33 image

Expecting to execute: 'git merge origin/branchToMerge'.

steveukx commented 3 weeks ago

Hi, thank you for opening the issue. The mergeFromTo code has been in place for a long time, and doesn't look to be compatible with modern versions of git - as you rightly point out it will trigger an octopus merge.

I'll update the docs etc soon, until then please use the format

git.merge(['origin/branch'])

github-actions[bot] commented 2 days ago

This issue has been automatically closed due to a lack of response. If your problem persists please open a new issue including any additional detail requested from this issue. For more detail on the issues/pull requests see ISSUES_AND_PULL_REQUESTS