Class: Git::Commands::CheckoutIndex Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/checkout_index.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:

Implements the git checkout-index command

This command copies all files listed in the index to the working directory (not overwriting existing files). It is typically used to populate a new working directory from the current index, optionally scoped to a specific path or prefix.

Examples:

Typical usage

checkout_index = Git::Commands::CheckoutIndex.new(execution_context)
checkout_index.call(all: true)
checkout_index.call(all: true, force: true)
checkout_index.call('path/to/file.txt')
checkout_index.call(all: true, prefix: 'output/')

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

Execute the git checkout-index command

Parameters:

  • file (Array<String>)

    zero or more file paths to check out

    When empty, no files are checked out individually (use :all to check out everything).

  • options (Hash)

    command options

Options Hash (**options):

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

    update stat information for the checked out entries in the index file

    Alias: :u

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

    suppress messages when files exist or are not in the index

    Alias: :q

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

    check out all files in the index

    Alias: :a

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

    force overwrite of existing files

    Alias: :f

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

    don't checkout new files, only refresh files already checked out

    Alias: :n

  • :prefix (String) — default: nil

    write file content under the given directory prefix instead of the working directory root

  • :stage (String) — default: nil

    check out from the named stage

    Pass '1', '2', or '3' for a specific stage number, or 'all' to check out all stages (automatically implies --temp).

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

    write file content to temporary files near the target location instead of checking them out

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

    check out all files, including those with the skip-worktree bit set

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits with a non-zero exit status



# File 'lib/git/commands/checkout_index.rb', line 45