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

P4 CLI Documentation | 2025.2

# Work with files

This section describes tasks you perform during the lifetime of your installation that occur at the file level.

Before we look at the tasks in detail, here’s a table that provides a snapshot of the sequence in which you perform the most common file-related tasks.

For details on working with changelists, see Work with changelists.

Here are the basic steps for working with files. In general, to change files in the depot (file repository), you open the files in changelists and submit the changelists with a description of your changes. P4 Server assigns numbers to changelists and maintains the revision history of your files. This approach enables you to group related changes and find out who changed a file and why and when it was changed.

Task | Description
--- | ---
Syncing (retrieving files from the depot) | Issue the `p4 sync` command, specifying the files and directories you want to retrieve from the depot. You can only sync files that are mapped in your client workspace view.
Add files to the depot | Create the file in the workspace. Open the file for add in a changelist (`p4 add`). Submit the changelist (`p4 submit`).
Edit files and check in changes | If necessary, sync the desired file revision to your workspace (`p4 sync`). Open the file for edit in a changelist (`p4 edit`). Make your changes. Submit the changelist (`p4 submit`). To discard changes, issue the `p4 revert` command.
Delete files from the depot | Open the file for delete in a changelist (`p4 delete`). The file is deleted from your workspace. Submit the changelist (`p4 submit`). The file is deleted from the depot.
Discard changes | Revert the files or the changelist in which the files are open. Reverting has the following effects on open files:
Add | no effect - the file remains in your workspace.
Edit | the revision you opened is resynced from the depot, overwriting any changes you made to the file in your workspace.
Delete | the file is resynced to your workspace.

Files are added to, deleted from, or updated in the depot only when you successfully submit the pending changelist in which the files are open. A changelist can contain a mixture of files open for add, edit and delete.

For details on working with changelists, see Work with changelists.

In this section:

Your search for returned results