Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Reference | 2025.1

# p4 switch

Create a stream, or switch to a different stream, with an option to populate that stream, or to display current streams.

## Syntax

    p4 [g-opts] switch [-c -m -v -P parent] [-Rx] [-r] [--no-sync] [--allow-unrelated] stream
    p4 [g-opts] switch [-r -v] [-Rx] [--no-sync] [--allow-unrelated] [stream]@change
    p4 [g-opts] switch -l -L
    p4 [g-opts] switch

Syntax conventions

## Description

This command allows you to create, manage, and switch between your streams.

This command automatically:

- reconciles and syncs ( `p4 reconcile` and `p4 sync`)

- shelves work-in-progress when switching between streams

`p4 switch [-r -v] [-Rx] [--no-sync] [--allow-unrelated] [stream]@change`
is for reproducing back-in-time view and revision synchronization. Specify a changelist number and, optionally, a stream. The client switches to the stream specification that was available at the time of that change. The workspace syncs to that changelist. If the stream is omitted but @change is specified, no stream switch is performed, but the workspace is synced to that change.

The `stream@change` argument sets the workspace view to match the version of a stream as of the specified changelist, and syncs the files to the versions matching that same changelist.

With no arguments, the switch command displays the current stream.

When switching to a different stream, the switch command first runs `p4 reconcile` to determine which files have been modified in the current stream.

If files are open in a numbered changelist, you cannot switch to a new stream.

If files are open in the default changelist:

- they are shelved and reverted prior to switching to the new stream
- they are automatically unshelved when switching back to this stream

After switching to the new stream, switch syncs your workspace to the head of the new stream, and unshelves any files that were open in the default changelist the last time you used that stream.

### Option to make switching between streams faster

If you want to limit the amount of data and metadata transferred when switching between streams, consider using the --no-sync option. You can then use p4 sync on a subset of the files or directories included in that stream.

## Options

`--allow-unrelated` | Allows switching to a different stream hierarchy The set of parent-to-child relationships between streams in a stream depot..
`-c` | Local (DVCS) server only Specifies that the new stream be created and populated with a copy of the files that are in the current stream.
`-l` | Lists all known streams.
`-L` | Lists all streams that were switched at the specified change with open files.
`-m` | Local (DVCS) server only Specifies that switch -c creates a new, empty stream with no parent. This is an independent mainline.
`-P parent` | Local (DVCS) server only Specifies that `p4 switch -c` creates a new stream with the specified stream as its parent. The new stream is populated with the files from the specified stream, rather than with the files from the current stream.
`-r` | Reopens files in the new mapped location of the specified stream. If you omit this option and you have opened files in the current stream, those files are: shelved before switching to the new stream unshelved when you switch back to this stream
`-Rx` | Controls how files are reconciled when switching between streams: Ra reconcile files not currently under P4 Server control. (Files open for add.) Re reconcile files that have been modified. (Files open for edit.) Rd reconcile files that have been removed. (Files marked for delete.) Rn reconcile does not run. Without this option, reconcile runs as if all options were set: -Raed
--no-sync | Prevents sync of file content for unopened files.
`-v` | Verbose mode.

## Usage Notes

Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required
--- | --- | ---
N/A | N/A | list for `p4 switch` without an option or with the `-l` or `-L` options `write` for the `-c` option open for the remaining options

## Examples

`p4 switch -r bugfix17` | Switch to the `bugfix17` stream and open all the files in it.

## Related commands

Merge | `p4 merge`
Resolve | `p4 resolve`
Switch for graph depot | `p4 switch (graph)`

Your search for returned results