Skip to content

Commit 3b76a0f

Browse files
committed
Merge branch 'bc/stash-export' into seen
A mechanism to export and import stash entries to and from a normal commit to transfer it across repositories has been introduced. * bc/stash-export: 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 75b7cb6 + e777bd9 commit 3b76a0f

File tree

5 files changed

+399
-15
lines changed

5 files changed

+399
-15
lines changed

Documentation/git-stash.txt

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ SYNOPSIS
2020
'git stash' clear
2121
'git stash' create [<message>]
2222
'git stash' store [-m|--message <message>] [-q|--quiet] <commit>
23+
'git stash' export ( --print | --to-ref <ref> ) [<stash>...]
24+
'git stash' import <commit>
2325

2426
DESCRIPTION
2527
-----------
@@ -151,6 +153,18 @@ store::
151153
reflog. This is intended to be useful for scripts. It is
152154
probably not the command you want to use; see "push" above.
153155

156+
export ( --print | --to-ref <ref> ) [<stash>...]::
157+
158+
Export the specified stashes, or all of them if none are specified, to
159+
a chain of commits which can be transferred using the normal fetch and
160+
push mechanisms, then imported using the `import` subcommand.
161+
162+
import <commit>::
163+
164+
Import the specified stashes from the specified commit, which must have been
165+
created by `export`, and add them to the list of stashes. To replace the
166+
existing stashes, use `clear` first.
167+
154168
OPTIONS
155169
-------
156170
-a::
@@ -239,6 +253,19 @@ literally (including newlines and quotes).
239253
+
240254
Quiet, suppress feedback messages.
241255

256+
--print::
257+
This option is only valid for `export`.
258+
+
259+
Create the chain of commits representing the exported stashes without
260+
storing it anywhere in the ref namespace and print the object ID to
261+
standard output. This is designed for scripts.
262+
263+
--to-ref::
264+
This option is only valid for `export`.
265+
+
266+
Create the chain of commits representing the exported stashes and store
267+
it to the specified ref.
268+
242269
\--::
243270
This option is only valid for `push` command.
244271
+
@@ -256,7 +283,7 @@ For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
256283

257284
<stash>::
258285
This option is only valid for `apply`, `branch`, `drop`, `pop`,
259-
`show` commands.
286+
`show`, and `export` commands.
260287
+
261288
A reference of the form `stash@{<revision>}`. When no `<stash>` is
262289
given, the latest stash is assumed (that is, `stash@{0}`).

0 commit comments

Comments
 (0)