Functions
2.1 Annotated Commit
2.2 Blame
2.3 Blob
2.4 Branch
2.5 Buffer
2.6 Checkout
2.7 Cherrypick
2.8 Clone
2.9 Commit
2.10 Config
2.11 Credentials
2.12 Describe
2.13 Diff
2.14 Fetch
2.15 Filter
2.16 Errors
2.17 Graph
2.18 Ignore
2.19 Index
2.20 Indexer
2.21 Global
2.22 Merge
2.23 Message
2.24 Note
2.25 Object
2.26 Object Database
2.27 Oid
2.28 Oid Array
2.29 Packbuilder
2.30 Patch
2.31 Pathspec
2.32 Proxy
2.33 Push
2.34 Rebase
2.35 Refdb
2.36 Reference
2.37 Reflog
2.38 Refspec
2.39 Remote
2.40 Repository
2.41 Reset
2.42 Revert
2.43 Revparse
2.44 Revwalk
2.45 Signature
2.46 Stash
2.47 Status
2.48 Strarray
2.49 Submodule
2.50 Tag
2.51 Tree
2.52 Treebuilder
On this page:
git_  stash_  apply
git_  stash_  apply_  init_  options
git_  stash_  drop
git_  stash_  foreach
git_  stash_  pop
7.7

2.46 Stash

 (require libgit2/include/stash) package: libgit2

procedure

(git_stash_apply repo index options)  integer?

  repo : repository?
  index : integer?
  options : git_stash_apply_opts?
Apply a single stashed state from the stash list.

If local changes in the working directory conflict with changes in the stash then GIT_EMERGECONFLICT will be returned. In this case, the index will always remain unmodified and all files in the working directory will remain unmodified. However, if you are restoring untracked files or ignored files and there is a conflict when applying the modified files, then those files will remain in the working directory.

If passing the GIT_STASH_APPLY_REINSTATE_INDEX flag and there would be conflicts when reinstating the index, the function will return GIT_EMERGECONFLICT and both the working directory and index will be left unmodified.

Note that a minimum checkout strategy of GIT_CHECKOUT_SAFE is implied.

procedure

(git_stash_apply_init_options opts version)  integer?

  opts : git_stash_apply_opts?
  version : integer?
Initializes a git_stash_apply_options with default values. Equivalent to creating an instance with GIT_STASH_APPLY_OPTIONS_INIT.

procedure

(git_stash_drop repo index)  integer?

  repo : repository?
  index : integer?
Remove a single stashed state from the stash list.

procedure

(git_stash_foreach repo callback payload)  integer?

  repo : repository?
  callback : git_stash_cb
  payload : bytes?
Loop over all the stashed states and issue a callback for each one.

If the callback returns a non-zero value, this will stop looping.

procedure

(git_stash_pop repo index options)  integer?

  repo : repository?
  index : integer?
  options : stash_apply_options?
Apply a single stashed state from the stash list and remove it from the list if successful.