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

P4 Server Administration Documentation | 2025.1

# Specify what to copy

As described in Remotes, an overview, you typically specify which files will be pushed or fetched by listing depot paths in the `DepotMap` field of the remote spec. You can further narrow the set of files to be fetched or pushed with one of two command-line arguments: one specifying a filespec pattern and the other specifying a stream (with the `-S` option).

If a filespec or stream name is provided, and the remote spec uses differing patterns for the local and remote sides of the DepotMap, the filespec argument or stream name must specify the files using the local server’s depot syntax. Note that the filespec must always be provided using depot syntax, not client syntax nor filesystem syntax. For more information, see Remotes, an overview.

- To specify a remote you pass the `-r` option and the name of the remote to the `p4 fetch` or `p4 push` command. If `-r` is not specified, the default is `-r origin`:

      p4 fetch -r markm-remote

- To specify a filespec you pass a filespec pattern to the `p4 fetch` or `p4 push` command.

      p4 fetch //depot/projectx/...

- To specify a stream you pass the `-S` option to the `p4 fetch` or `p4 push` command. Note that the stream must be listed in a depot mapping in your remote spec.

      p4 fetch -S //stream/dev

  where `dev` is the name of the stream on your local server

Note that when you specify a filespec or a stream, P4 Server cannot use the performance optimization provided by the remote spec.

Unlike other versioning engines such as Git, you do not have to fetch or push the entire contents of the remote server’s repository; rather, you can fetch or push whatever subset of the repository you like. You specify this subset in the remote spec or at the command line of the fetch or push command.

In this section:

Your search for returned results