Class: Git::Commands::Stash::Push Private

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

Stash changes in the working directory

Saves local modifications to a new stash entry and rolls them back to HEAD (in the working tree and index). The command takes various options to customize what gets stashed.

Examples:

Save all changes with a message

Git::Commands::Stash::Push.new(execution_context).call(message: 'WIP: feature work')

Stash only specific files

Git::Commands::Stash::Push.new(execution_context).call('src/file.rb', message: 'Partial stash')

Keep staged changes in index

Git::Commands::Stash::Push.new(execution_context).call(keep_index: true)

Include untracked files

Git::Commands::Stash::Push.new(execution_context).call(include_untracked: 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(*pathspec, **options) ⇒ Git::CommandLineResult

Stash changes in the working directory

Parameters:

  • pathspec (Array<String>)

    optional paths to limit what gets stashed

  • options (Hash)

    command options

Options Hash (**options):

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

    interactively select hunks to stash

    Alias: :p

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

    stash only staged changes

    Alias: :S

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

    keep staged changes in the index (--keep-index)

    Alias: :k

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

    do not preserve staged changes in the index (--no-keep-index)

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

    suppress informational messages

    Alias: :q

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

    include untracked files in the stash

    Alias: :u

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

    include untracked and ignored files in the stash

    Alias: :a

  • :message (String) — default: nil

    descriptive message for the stash

    Alias: :m

  • :pathspec_from_file (String) — default: nil

    read pathspecs from the given file

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

    pathspecs in the file are NUL-separated

Returns:

Raises:



# File 'lib/git/commands/stash/push.rb', line 51