Copy files from the depot into the client workspace
p4 sync brings the client workspace in sync with the depot by copying files matching the file pattern arguments from the depot into the client workspace. When no file patterns are specified on the command line, it will copy a particular depot file only if it meets the following criteria:
In new, empty, client workspaces, all depot files meet the last two criteria, so all the files visible through the client view will be copied into the client workspace.
If file patterns are specified on the command line, only those files that match the file patterns and that meet the above criteria are copied. If the file pattern contains a revision specifier, the specified revision is copied into the client workspace. If the file argument includes a revision range, only files selected by the revision range are updated, and the highest revision in the range is used.
The newly-synced files are not available for editing until opened with p4 edit or p4 delete. Newly-synced files are read-only; p4 edit and p4 delete make the files writable. Under normal circumstances, you should not use OS commands to make the files writable; let Perforce do this for you.
-n | Display the results of the sync without actually performing the sync. This lets you make sure that the sync does what you think it does before you do it. |
-f | Force the sync. Perforce performs the sync even if the client workspace already has the file at the specified revision, and even if the file is not writable. This flag does not affect open files. |
g_opts | See global options section. |
Can File Arg Use Revision Specifier? |
Can File Arg Use Revision Range? |
Minimal Access Level Required |
---|---|---|
Yes | Yes | read |
To open a file in a client workspace and list it in a changelist |
p4 add p4 edit p4 delete p4 integrate |
To copy changes to files in the client workspace to the depot | p4 submit |
To view a list of files and revisions that have been synced to the client workspace | p4 have |