Switch between streams

To switch between streams issue this command:

p4 switch other_stream

When switching to a different stream, the p4 switch command first runs p4 reconcile to determine which files have been modified in the current stream. It then shelves any changed files for safekeeping.

After switching to a new stream, switch syncs your client workspace to the head of the new stream, and unshelves any files that were open and any changelists pending the last time you used that stream.

Note

You cannot switch to a new stream if files are open in a numbered changelist. If files are open in the default changelist, they will be shelved and reverted prior to switching to the new stream, and will be automatically unshelved when switching back to this stream.

To switch to a different stream and bring changed files with you from the current stream, pass the -r option:

$ p4 switch -r

Here’s the list of all of our streams:

$ p4 switch -l
child_of_main
dev *
gui
main

Here’s the stream we’re currently in:

$ p4 switch
dev

Here are the files currently open in //stream/dev:

$ p4 files //stream/dev/...
//stream/dev/asciidoc/branching#1 - branch change 44 (text)
//stream/dev/asciidoc/fetching_and_pushing#1 - branch change 44 (text)
//stream/dev/asciidoc/initializing_a_server#1 - branch change 44 (text)
//stream/dev/asciidoc/intro#1 - branch change 44 (text)
//stream/dev/asciidoc/remote_spec#1 - branch change 44 (text)
//stream/dev/asciidoc/understanding_remotes#1 - branch change 44 (text)
//stream/dev/dvcs_commands/clone.xml#1 - branch change 44 (text)
//stream/dev/dvcs_commands/fetch.xml#1 - branch change 44 (text)
//stream/dev/dvcs_commands/init.xml#1 - branch change 44 (text)
//stream/dev/dvcs_commands/push.xml#1 - branch change 44 (text)
//stream/dev/dvcs_commands/remote.xml#1 - branch change 44 (text)
//stream/dev/dvcs_commands/remotes.xml#1 - branch change 44 (text)
//stream/dev/dvcs_commands/resubmit.xml#1 - branch change 44 (text)
//stream/dev/dvcs_commands/switch.xml#1 - branch change 44 (text)
//stream/dev/dvcs_commands/unsubmit.xml#1 - branch change 44 (text)
//stream/dev/dvcs_commands/unzip.xml#1 - branch change 44 (text)
//stream/dev/dvcs_commands/zip.xml#1 - branch change 44 (text)
//stream/dev/dvcs_user_guide/00_preface.xml#1 - branch change 44 (text)
//stream/dev/dvcs_user_guide/git_to_perforce.xml#1 - branch change 44 (text)
//stream/dev/resubmit.xml#1 - branch change 44 (text)

Now we open new files in dev:

$ p4 add a b c

If we then issue the following command, we switch to the gui stream but bring over the content that was changed in dev.

$ p4 switch -r gui
$ ls
a b c