Class: Git::Commands::Merge::Start Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/merge/start.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Note:

arguments block audited against https://git-scm.com/docs/git-merge/2.53.0

Implements git merge to incorporate changes from named commits

Joins two or more development histories together by incorporating changes from the named commits into the current branch.

Examples:

Simple merge

merge = Git::Commands::Merge::Start.new(execution_context)
merge.call('feature')

Merge with no fast-forward

merge.call('feature', ff: false, m: 'Merge feature branch')

Squash merge

merge.call('feature', squash: true)

Merge with strategy option

merge.call('feature', strategy: 'ort', strategy_option: 'theirs')

Octopus merge (multiple branches)

merge.call('branch1', 'branch2', 'branch3')

See Also:

Instance Method Summary collapse

Methods inherited from Base

allow_exit_status, arguments, #initialize, requires_git_version, skip_version_validation

Constructor Details

This class inherits a constructor from Git::Commands::Base

Instance Method Details

#call(*commit, **options) ⇒ Git::CommandLineResult

Execute the git merge command

Parameters:

  • commit (Array<String>)

    one or more branch names, commit SHAs, or refs to merge into the current branch; multiple commits create an octopus merge

  • options (Hash)

    command options

Options Hash (**options):

  • :commit (Boolean, nil) — default: nil

    perform merge and commit the result (--commit)

  • :no_commit (Boolean, nil) — default: nil

    do not perform a merge commit (--no-commit)

  • :edit (Boolean, nil) — default: nil

    open an editor for the merge commit message (--edit)

    Alias: :e

  • :no_edit (Boolean, nil) — default: nil

    skip the editor for the merge commit message (--no-edit)

  • :cleanup (String) — default: nil

    how the merge message will be cleaned up before committing

    Accepted values include strip, whitespace, verbatim, scissors, and default. Emits --cleanup=<mode>.

  • :ff (Boolean, nil) — default: nil

    allow fast-forward merges (--ff)

  • :no_ff (Boolean, nil) — default: nil

    create a merge commit even when fast-forward is possible (--no-ff)

  • :ff_only (Boolean, nil) — default: nil

    refuse to merge unless fast-forward is possible; emits --ff-only

  • :gpg_sign (Boolean, String, nil) — default: nil

    GPG-sign the resulting merge commit (--gpg-sign)

    Pass a key ID string to select the signing key; pass true to use the committer identity. Alias: :S

  • :no_gpg_sign (Boolean, nil) — default: nil

    countermand commit.gpgSign configuration (--no-gpg-sign)

  • :log (Boolean, Integer, nil) — default: nil

    populate the merge message with one-line commit descriptions (--log)

    Pass an Integer n to limit to n entries (--log=<n>).

  • :no_log (Boolean, nil) — default: nil

    do not list one-line commit descriptions (--no-log)

  • :signoff (Boolean, nil) — default: nil

    add a Signed-off-by trailer to the commit message (--signoff)

  • :no_signoff (Boolean, nil) — default: nil

    remove a Signed-off-by trailer from the commit message (--no-signoff)

  • :stat (Boolean, nil) — default: nil

    show a diffstat at the end of the merge (--stat)

  • :no_stat (Boolean, nil) — default: nil

    suppress the diffstat at the end of the merge (--no-stat)

  • :compact_summary (Boolean, nil) — default: nil

    show a compact summary at the end of the merge; emits --compact-summary

  • :squash (Boolean, nil) — default: nil

    produce working tree and index state as if a real merge happened, but do not commit; emits --squash

  • :verify (Boolean, nil) — default: nil

    run pre-merge and commit-msg hooks (--verify)

  • :no_verify (Boolean, nil) — default: nil

    bypass pre-merge and commit-msg hooks (--no-verify)

  • :strategy (String) — default: nil

    merge strategy to use (e.g., 'ort', 'recursive', 'resolve', 'octopus', 'ours', 'subtree')

    Emits --strategy=<strategy>. Alias: :s

  • :strategy_option (String, Array<String>) — default: nil

    pass option(s) to the merge strategy (e.g., 'ours', 'theirs', 'patience')

    Can be a single value or an array for multiple --strategy-option flags. Emits --strategy-option=<option>. Alias: :X

  • :verify_signatures (Boolean, nil) — default: nil

    verify commit signatures on the tip of the side branch (--verify-signatures)

  • :no_verify_signatures (Boolean, nil) — default: nil

    do not verify commit signatures (--no-verify-signatures)

  • :quiet (Boolean, nil) — default: nil

    operate quietly; emits --quiet

    Alias: :q

  • :verbose (Boolean, nil) — default: nil

    be verbose; emits --verbose

    Alias: :v

  • :progress (Boolean, nil) — default: nil

    force progress status reporting (--progress)

  • :no_progress (Boolean, nil) — default: nil

    suppress progress status reporting (--no-progress)

  • :autostash (Boolean, nil) — default: nil

    automatically stash and unstash the working tree before and after the operation (--autostash)

  • :no_autostash (Boolean, nil) — default: nil

    do not automatically stash and unstash the working tree (--no-autostash)

  • :allow_unrelated_histories (Boolean, nil) — default: nil

    allow merging histories that do not share a common ancestor (--allow-unrelated-histories)

  • :no_allow_unrelated_histories (Boolean, nil) — default: nil

    disallow merging unrelated histories (--no-allow-unrelated-histories)

  • :m (String) — default: nil

    commit message for the merge commit; emits -m <msg>

  • :into_name (String) — default: nil

    prepare the default merge message as if merging to the named branch; emits --into-name <branch>

  • :file (String) — default: nil

    read the commit message from the given file; emits --file=<file>. Alias: :F

  • :rerere_autoupdate (Boolean, nil) — default: nil

    allow rerere to update the index with the auto-resolved conflict result (--rerere-autoupdate)

  • :no_rerere_autoupdate (Boolean, nil) — default: nil

    prevent rerere from auto-updating the index (--no-rerere-autoupdate)

  • :overwrite_ignore (Boolean, nil) — default: nil

    silently overwrite ignored files from the merge result (--overwrite-ignore)

  • :no_overwrite_ignore (Boolean, nil) — default: nil

    abort if the merge result would overwrite any ignored files (--no-overwrite-ignore)

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits with a non-zero exit status



# File 'lib/git/commands/merge/start.rb', line 102