Class: Git::Commands::Stash::Branch Private

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

Create a branch from a stash entry

Creates a new branch starting from the commit at which the stash was originally created, applies the stashed changes, and then drops the stash if the changes are applied successfully.

This is useful if the branch on which you ran git stash push has changed enough that git stash apply fails due to conflicts. The new branch will be created at the commit that was HEAD when the stash was created, so applying the stash should succeed.

Examples:

Create branch from latest stash

Git::Commands::Stash::Branch.new(execution_context).call('my-branch')

Create branch from specific stash

Git::Commands::Stash::Branch.new(execution_context).call('my-branch', 'stash@{2}')

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(branchname) ⇒ Git::CommandLineResult #call(branchname, stash) ⇒ Git::CommandLineResult

Create a branch from a stash entry

Overloads:

  • #call(branchname) ⇒ Git::CommandLineResult

    Create a branch from the latest stash

    Parameters:

    • branchname (String)

      the name of the branch to create (required)

  • #call(branchname, stash) ⇒ Git::CommandLineResult

    Create a branch from a specific stash

    Parameters:

    • branchname (String)

      the name of the branch to create (required)

    • stash (String)

      stash reference (e.g., 'stash@{0}', '0')

Returns:

Raises:



# File 'lib/git/commands/stash/branch.rb', line 41