Shelve and unshelve files
Shelving stores a copy of your open files on the P4 Server without submitting them. Shelved files remain associated with a changelist and can be accessed by other users, which makes shelving useful for sharing work in progress, performing code reviews, or backing up changes before switching tasks.
Files must be open in a pending changelist before they can be shelved. Shelving does not create a new file revision in the depot.
On this page:
Control what happens to local files when shelving
Use the P4: File Shelve Mode setting under Extensions > P4 VS Code to control how the P4 for Visual Studio Code extension handles local workspace files during shelving:
-
prompt (default): Prompts you to choose whether to keep or remove local files.
-
swap: Removes local workspace files after shelving.
-
keep both: Keeps local workspace files after shelving.
This setting applies when shelving a file.
Shelve files in a changelist
-
In the Source Control view, right‑click the pending changelist.
-
Select Shelve changelist.
The files in the changelist are shelved on the P4 Server. Depending on the P4: File Shelve Mode setting, local workspace files may be kept or removed.
Shelve and revert files
Use this option to shelve your changes and immediately revert the local files, freeing the changelist.
-
In the Source Control view, right‑click the pending changelist.
-
Select Shelve and revert changelist.
The files are shelved on the P4 Server and removed from your local workspace.
Unshelve files
You can restore shelved files to your workspace.
-
In the Source Control view, locate the changelist that contains shelved files.
-
Right‑click the changelist or a specific shelved file and select Unshelve.
The shelved files are restored to your workspace. Shelved files cannot be unshelved if the same file is already open in the target changelist.
Delete shelved files
You can remove shelved files that are no longer needed.
-
In the Source Control view, right‑click the shelved file or changelist.
-
Select Delete shelved file or Delete shelved files in changelist.
Only the owner of the changelist can delete shelved files.