Class: Git::Commands::Worktree::Remove Private

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

Removes a linked worktree

Examples:

Remove a clean worktree

Git::Commands::Worktree::Remove.new(execution_context).call('/tmp/feature')

Force-remove an unclean worktree

Git::Commands::Worktree::Remove.new(execution_context).call('/tmp/feature', 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, **options) ⇒ Git::CommandLineResult

Remove a linked worktree

Parameters:

  • worktree (String)

    path or unique suffix identifying the worktree to remove

  • options (Hash)

    command options

Options Hash (**options):

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

    remove even if the worktree has uncommitted changes

    Pass true or 1 to emit --force once. Pass 2 to emit --force --force, which also removes locked worktrees.

    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/remove.rb', line 34