Class: Git::Commands::Worktree::Move Private

Inherits:
ManagementBase show all
Defined in:
lib/git/commands/worktree/move.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-worktree/2.54.0

Moves a linked worktree to a new filesystem location

Examples:

Move a worktree to a new path

Git::Commands::Worktree::Move.new(execution_context).call('/tmp/old', '/tmp/new')

Force-move a locked worktree

Git::Commands::Worktree::Move.new(execution_context).call('/tmp/feat', '/tmp/feat2', force: true)

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(worktree, new_path, **options) ⇒ Git::CommandLineResult

Move a linked worktree to a new filesystem location

Parameters:

  • worktree (String)

    path or unique suffix identifying the worktree to move

  • new_path (String)

    destination path for the worktree

  • options (Hash)

    command options

Options Hash (**options):

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

    allow moving a locked worktree

    Pass true or 1 to emit --force once. Pass 2 to emit --force --force, which also handles locked or missing destinations.

    Alias: :f

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits with a non-zero exit status



# File 'lib/git/commands/worktree/move.rb', line 35