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, p4 switch syncs your client 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.

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.

The shelving process stores files in the depot from a pending changelist without submitting them. If you decide that the change you were making in a particular stream, actually belongs in a different stream, you can run p4 switch -r stream_name to apply the changes on the current stream to the stream specified in the switch command.

$ p4 switch -r stream_name

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 in //stream/dev:

$ p4 files //stream/dev/...
//stream/dev/dvcs_commands/remote.xml#1 - branch change 43 (text)
//stream/dev/dvcs_commands/remotes.xml#1 - branch change 43 (text)
//stream/dev/dvcs_commands/resubmit.xml#1 - branch change 43 (text)
//stream/dev/dvcs_commands/switch.xml#1 - branch change 43 (text)
//stream/dev/dvcs_commands/unsubmit.xml#1 - branch change 43 (text)
//stream/dev/dvcs_commands/unzip.xml#1 - add change 44 (text)
//stream/dev/dvcs_commands/zip.xml#1 - edit change 45 (text)
//stream/dev/dvcs_user_guide/00_preface.xml#1 - edit change 46 (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 remote.xml remotes.xml switch.xml zip.xml