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

P4 CLI Documentation | 2025.2

# Create your first stream

A stream is where you store your work. The first stream is always a mainline stream. To learn more about streams, see Streams.

P4 Server allows a stream to be re-parented to any other stream with the same depot root. Although it is possible to have multiple mainline streams in a stream depot, we recommend that you create only one mainline for each stream depot. Having a single mainline stream in a stream depot:

- Avoids the possibility of accidentally re-parenting a child stream to a different mainline than that from which the stream originated.
- Simplifies the visual representation in P4 Visual Client (P4V).

To create the stream:

1. Run the ``p4 stream`` command, specifying the stream depot name followed by the stream name.

   Here, we name the stream `main`, so its full name is `//JameCode/main`, and we use the `-t` option to specify the stream type as mainline:

       p4 stream -t mainline //JamCode/main

   P4 Server opens the stream spec in an editor:

   Copy

       # A Perforce Stream Specification.
       #
       #  Stream:       The stream field is unique and specifies the depot path.
       #  Update:       The date the specification was last changed.
       #  Access:       The date the specification was originally created.
       #  Owner:        The user who created this stream.
       #  Name:         A short title which may be updated.
       #  Parent:       The parent of this stream, or 'none' if Type is mainline.
       #  Type:         Type of stream provides clues for commands run
       #                between stream and parent.  Seven types include 'mainline',
       #                'development' (default), 'release', 'sparsedev',
       #                'sparserel', 'task', and 'virtual'.
       #  Description:  A short description of the stream (optional).
       #  Options:      Stream Options:
       #                       allsubmit/ownersubmit [un]locked
       #                       [no]toparent [no]fromparent mergedown/mergeany
       #  Paths:        Identify paths in the stream and how they are to be
       #                generated in resulting clients of this stream.
       #                Path types are share/isolate/import/import+/exclude.
       #  Remapped:     Remap a stream path in the resulting client view.
       #  Ignored:      Ignore a stream path in the resulting client view.
       #
       # Use 'p4 help stream' to see more about stream specifications and command.

       Stream: //JamCode/main

       Owner:  bruno
       Name:   main
       Parent: none
       Type:   mainline
       Description:
           Created by bruno.
           Use a tab to indent any lines below a field name.

       Options:        allsubmit unlocked notoparent nofromparent mergedown
       Paths:
               share ...

   A stream spec defines the stream’s name and location, its type, its parent stream, the files in the workspace view of workspaces bound to it, and other configurable behaviors. Note that the stream name is composed of the stream depot name followed by the stream name. You edit the stream spec’s fields to configure the stream’s behavior. To learn more, see Configure streams.

2. Save the file and exit the editor.

3. Notice that the command line now shows `Stream //JamCode/main saved`.

4. To verify that your mainline stream has been created, issue the p4 streams command to display a list of streams.

       p4 streams //JamCode/...

   The output is:

       Stream //JamCode/main mainline none 'main'

Your search for returned results