Skip to content

Commit 02cebd5

Browse files
committed
Merge branch 'bc/stash-export-import' into jch
An interchange format for stash entries is defined, and subcommand of "git stash" to import/export has been added. * bc/stash-export-import: builtin/stash: provide a way to import stashes from a ref builtin/stash: provide a way to export stashes to a ref builtin/stash: factor out revision parsing into a function object-name: make get_oid quietly return an error
2 parents 6544c00 + c0a0af1 commit 02cebd5

File tree

5 files changed

+577
-13
lines changed

5 files changed

+577
-13
lines changed

Documentation/git-stash.adoc

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ SYNOPSIS
2323
'git stash' clear
2424
'git stash' create [<message>]
2525
'git stash' store [(-m | --message) <message>] [-q | --quiet] <commit>
26+
'git stash' export (--print | --to-ref <ref>) [<stash>...]
27+
'git stash' import <commit>
2628

2729
DESCRIPTION
2830
-----------
@@ -154,6 +156,18 @@ store::
154156
reflog. This is intended to be useful for scripts. It is
155157
probably not the command you want to use; see "push" above.
156158

159+
export ( --print | --to-ref <ref> ) [<stash>...]::
160+
161+
Export the specified stashes, or all of them if none are specified, to
162+
a chain of commits which can be transferred using the normal fetch and
163+
push mechanisms, then imported using the `import` subcommand.
164+
165+
import <commit>::
166+
167+
Import the specified stashes from the specified commit, which must have been
168+
created by `export`, and add them to the list of stashes. To replace the
169+
existing stashes, use `clear` first.
170+
157171
OPTIONS
158172
-------
159173
-a::
@@ -242,6 +256,19 @@ literally (including newlines and quotes).
242256
+
243257
Quiet, suppress feedback messages.
244258
259+
--print::
260+
This option is only valid for `export`.
261+
+
262+
Create the chain of commits representing the exported stashes without
263+
storing it anywhere in the ref namespace and print the object ID to
264+
standard output. This is designed for scripts.
265+
266+
--to-ref::
267+
This option is only valid for `export`.
268+
+
269+
Create the chain of commits representing the exported stashes and store
270+
it to the specified ref.
271+
245272
\--::
246273
This option is only valid for `push` command.
247274
+
@@ -259,7 +286,7 @@ For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
259286
260287
<stash>::
261288
This option is only valid for `apply`, `branch`, `drop`, `pop`,
262-
`show` commands.
289+
`show`, and `export` commands.
263290
+
264291
A reference of the form `stash@{<revision>}`. When no `<stash>` is
265292
given, the latest stash is assumed (that is, `stash@{0}`).

0 commit comments

Comments
 (0)