Renaming Files

How do you rename a file?

Info & Tags

Article #:
7
Created:
02/23/07
Modified:
01/09/08

PROBLEM

How do you rename a file?

SOLUTION

In Perforce you rename a file by integrating the existing file into a new file and deleting the existing one. For example, to rename foo to bar in the ola directory:

	
cd ola
p4 integ foo bar
p4 delete foo
p4 submit

This marks the head revision of foo as deleted. When anyone syncs to the ola directory now, their workspace versions of foo will be deleted and replaced with bar.

To see the complete change history of bar, including changes that affected it when it was named foo, use the "-i" option:

	
p4 changes -i bar

If you forget what bar was originally called, you can always find out by looking at the last lines output by:

	
p4 filelog bar