p4 unshelve

Restore shelved files and/or the stream spec from a pending change into a workspace.

Syntax conventions

p4 [g-opts] unshelve -s shelvedchange [-A [-f | -s] -n] [-c change] 
                      [-b branch | -S stream [-P stream]] [file ...]

Description

The p4 unshelve command retrieves shelved files from the specified pending changelist, opens them in a pending changelist, and copies them to the invoking user's workspace.

Unshelving files from a pending changelist is restricted by the user's permissions on the files. Access to shelved files from a pending changelist is controlled by the user’s permissions on the files.

In addition to the files being unshelved, p4 unshelve also unshelves any open stream specification. For open stream specifications, see p4 stream.

You can limit the files to be unshelved by specifying a file pattern.

Unshelving copies the shelved files into the user’s workspace as they existed when they were shelved. (For example, a file open for edit when shelved will also be open for edit in the unshelving user’s workspace.)

You can unshelve a promoted shelf into open files and branches on a server from where the shelf did not originate.

By default, the unshelve command acts on both the files and the stream spec.

  • To unshelve only files, use p4 unshelve -Af
  • To unshelve only the stream spec, use p4 unshelve -As

See also the p4 help streamcmds command-line output.

Note

Unshelving a file over an already opened file is permitted if both shelved file and opened file are opened for edit. In a multi-server environment, the shelf must either be promoted or have been created on the same edge server. After unshelving, the workspace file is flagged as unresolved, and p4 resolve must be run to resolve the differences between the shelved file and the workspace file.

Unshelving a file opened for add when the file already exists in the depot results in the file being opened for edit. After unshelving, the workspace file is flagged as unresolved, and p4 resolve must be run to resolve the differences between the shelved file and the depot file at the head revision.

Note

As a best practice, use the -f option to unshelve a shelf that has added files.

p4 obliterate myfile does not obliterate a shelve of the file (archive or metadata). If you attempt to unshelve a file that has been obliterated, you will get an error. To recover the content of that file, print the file. To get rid of the shelve, delete the shelf.

Options

-A

Used with -f to unshelve only files, or with -s to unshelve only the stream spec.

-b branch

Specifies a branch spec through which the shelved files will be mapped prior to unshelving. This option enables you to shelve files in one branch and unshelve them in another.

-c change

Specify a changelist number in the user’s workspace into which the files are to be unshelved. By default, p4 unshelve retrieves files into the default changelist.

-f

Force the overwriting of writable (but unopened) files during the unshelve operation.

-n

Preview the results of the unshelve operation without actually restoring the files to your workspace.

-P stream

Unshelve to the specified parent stream. Overrides the parent defined in the source stream specification.

-s shelvedchange

Specify the pending changelist number that contains the originally-shelved files.

-S stream

Specifies the use of a stream-derived branch view to map the shelved files between the specified stream and its parent stream. See also the -P option.

g-opts

See Global options.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

Yes

Yes

open

Related Commands

To store files from a pending changelist into the depot without submitting them.

p4 shelve