It is sometimes useful to have more than one workspace in Perforce. I have found that this gives me more freedom to work on multiple bugs or features at the same time for the same branch.
$ p4 client my_client_2
This opens the configuration of a new client named
my_client_2 in your favorite editor. Here you can provide the root directory for this client and mappings as your normally would. Save and exit the editor.
$ mkdir -p /home/joe/p4_workspaces/my_workspace_2
$ export P4CLIENT=my_client_2
Now you can run commands such as
sync and they should work in this new workspace.
Create a file named
.p4config in the root directory of the new workspace,
/home/joe/p4_workspaces/my_workspace_2 in this example, with the environment variables and their values you want to set:
Now when you are at any child directory of the new workspace, P4 will know that it has to use the above client config for its commands. You need to place such config files at the roots of all your workspaces to have a pleasant working experience when moving between workspaces.