p4 move
Move (rename) a file from one location to another within the branch.
Syntax
p4 [g-opts] move [-c change] [-f -n -k] [-t filetype] fromFileSpec toFileSpec p4 [g-opts] move -r [-c change] [-n -k] fromFileSpec toFileSpec p4 g-opts move -M [-c change] [-n] [--parallel=N]
Description
The p4 move
command takes a file already opened for
edit or add and moves it to the destination provided.
An open file can be moved many times before it is submitted. Moving a
file back to its original location undoes the pending move, leaving it
open for edit. Using p4
revert
on a moved file both undoes the move and
reverts the unsubmitted content.
The p4 move command should only be used for intra-branch file rename or move, that is, renaming a file within the same directory, or between directories within the same directory tree. To learn how to restructure the depot by moving an entire branch, see the Perforce Knowledge Base article, "Renaming Depot Directories".
Options
If a changelist number is provided, the files are opened in the numbered pending changelist to find matching moves in the existing pending changelist and reopen the added and deleted files as moves. |
|
|
If a filetype is specified, the file is reopened as the new filetype. |
|
Preview the move that would be performed, without actually moving files. |
|
Force a move to an existing target file. The file must be synced, but not opened. The originating source file will no longer be synced to the workspace. If you use |
|
Perform the rename on the server without modifying files on the client workspace. However, a p4 sync is still required. An incorrect move can cause discrepancies between the state of the client workspace and the corresponding server metadata Information that P4 Server maintains, such as who created file revisions in the depot, whether the file is a 'lazy copy,, the current state of client workspaces, protections, groups, users, labels, streams, and branches. Metadata is stored in the server database and is separate from the 'archive files' that users submit from their client workspace into the depot..
|
-r
|
Rename existing files without altering
content or type to a new target. This option allows the user to
move files from the depot to a different location without opening
the files first. This option performs a strict rename only. Therefore the -t and -f flags are not allowed, source files must not be
already opened, and the targets must not already exist. |
-M
|
Matches the already opened files for add and delete in the default or specified changelist and reopens them as a move. |
---parallel=N | Used with -M to specify the number of files opened for add to be compared simultaneously on the client to the file opened for delete. This might improve the performance of the move matching. |
|
Preview the move that would be performed, without actually moving files. |
|
See Global options. |
Usage notes
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required | Command Alias |
---|---|---|---|
|
No |
read access for fromFile |
p4 rename |
- Files must be open for
add
or open foredit
before they can be moved. - To move and resolve a file that is open for edit but has been renamed
at the head revision, use the
-f
option to force the move.
Examples
|
Assuming that |
|
Move open files from one directory to another within the same depot tree. |
|
Move or rename a file where either the target path is a substring of the source path, or the source path is a substring of the target path. In this example, the directory |