Reputation: 148
How do I add files to Perforce using P4?
Upvotes: 1
Views: 1078
Reputation: 4850
If you know what the path would be on disk, you don't need to sync anything. You can create the directory and files and then just use p4 add. For example:
1) I create a new workspace mapping a set of files from the server. Here is an example workspace:
Root:
/Users/matt/p4
View:
//depot/main/project/... //workspace/...
Here I am creating a 1 to 1 mapping of the files in the server //depot/main/project to my local machine at /Users/matt/p4. When I read this I read it as:
//depot/main/project/... /Users/matt/p4/...
2) I know that the files I want to add should live in //depot/main/project/foo/bar so I create the directory and my files:
cd /Users/matt/p4
mkdir -p foo/bar
touch foo/bar/test.txt
3) Last but not least I add and submit:
p4 status -A
p4 submit -d "Adding a file without syncing first"
Upvotes: 2