I know that if I need to clone a perforce an existing p4 repository using command
git p4 clone //depot/path/project
But what if I want to m
The solution that I found was clonning different Perforce paths into different Git repositories and later merge them into a new repository while keeping the history.
//depot/Projects/A
...
//depot/Projects/C
//depot/Projects/...
Clonning Perforce repository into git:
git p4 clone //depot/Projects/A@all
git p4 clone //depot/Projects/C@all
Then create an empty Git repository:
mkdir project
cd project
git init
Add repositories path:
git remote add -f a ../A
git remote add -f c ../C
Merge Project A:
git merge --allow-unrelated-histories a/master
Move Project A into a subdir:
mkdir dir_a
find . -maxdepth 1 -not -name ".git" -and -not -name "dir_a" -exec git mv {} dir_a/ \;
Commit changes:
git commit -m "Merge Project A"
Merge Project C:
git merge --allow-unrelated-histories c/master
mkdir dir_c
find . -maxdepth 1 -not -name ".git" -and -not -name "dir_a" -and -not -name "dir_c" -exec git mv {} dir_c/ \;
git commit -m "Merge Project C"
Using Git:
$ git --version
git version 2.14.1
You can do this with the --use-client-spec
option to git-p4. See the "CLIENT SPEC" section in the git-p4 documentation.
When you use this option, git-p4 uses your Perforce client view to map depot paths into your Git repository. By setting up a Perforce client with the mappings you want, you can selectively import parts of your Perforce depot.