1. Configure environment variables:
Download perforce to/usr/bin/
Export p4port = 192.168.4.88: 1666 # host where p4 is located
Export p4client = Dev-Client # specifies the client that communicates with the perforce server.
Export p4user = daihh # P4 User Name
Export p4passwd = 123456 # P4 Password
Export p4charset = utf8 # character set used to call the command
P4-h # view help
P4client can be used later: Linux hostname to view the host name.
2.
P4 Login
Then the client may be configured and then P4 sync will download the code.
3. Note that folder submission is not supported when creating a directory. This is different from SVN. (Perforce does not perform version management on directories at all, so there is no similar add command. Perforce always tracks only versions of files. After a file is added, the path of the file determines which directories are also "added" to the repository. This leads to a problem. The empty directory left after the file is deleted must be deleted manually. Although these empty directories do not affect the warehouse, they reflect the inconsistency between the warehouse and the working directory, making confusing easier. Therefore, there is only one way to add a directory in perforce to add all the files in sequence. This is a tough task, but fortunately there is still a shortcut :)
$ CD directory_need_add
$ Find.-Type F-print | P4-X-add
$ P4 submit
Similar operations to delete a directory are also true. Replace add with Delete.
In addition, the most annoying thing is that you do not know what files have been modified locally (if P4 edit file is not declared in advance) and which files have not been included in version control. Subversion is simple. You only need SVN status to view the status from the initial letter. Perforce does not consider these issues from a human perspective, so it can only take a few more steps:
$ Find .! -Type D | xargs P4 have 2> & 1>/dev/null
Window7 perforce usage
P4 set p4port = Xiaodao. CO: 8888
P4 set p4client = Xiaodao-wks
P4 set passwd = abcd1234
P4 set user = Xiaodao
Sync
P4-U % USER %-P % passwd %-C % p4client %-P % p4port % sync/projects /...
Edit
P4-U % USER %-P % passwd %-C % p4client %-P % p4port % edit/projects/file. TX
Submit
P4 submit-d "Description" // projects/file.txt
Get the file version number
P4-U % USER %-C % p4client %-P % p4port % files-Q // projects/folder/...> D: \ get_file_rev.txt