 <p><strong>Summary:</strong> It works, git-p4 is a great tool, very intelligent, comes with lot of configurable options. Multiple branches scattered wherever across depot tree migrated successfully. We need to run the import at highest level (topmost) perforce directory that covers all sub-directories or branches of interest. For efficient operation, suggested to use <strong><em>--changesfile</em></strong> option, to explicitly specify changelists to be imported. Also use <strong><em>git-p4.branchUser</em></strong> and <strong><em>git-p4.branchList</em></strong> to explicitly specify branchspecs. </p> <p><strong>Details:</strong> Here I am showing the settings that worked for me. There may be a better way to achieve the goal. </p> <p><strong>Perforce depot structure:</strong> (as mentioned in question) </p> <p><strong>Perforce client:</strong> This is set at highest (topmost) p4 directory. This is very important, otherwise git-p4 may exclude changelists (restricted due to client view) as empty commits.</p> <pre><code> //depot/... //myp4client/... </code></pre> <p><strong>Perforce branchspecs:</strong> I created a single branchspec that covers all my branches dependency (parent/child) information</p> <pre><code>$ p4 branch -o test1 | grep "//" //depot/dev/project/master/... //depot/dev/project/branch1/... //depot/dev/project/master/... //depot/dev/project/branch2/... //depot/dev/project/branch1/... //depot/dev/sub-project/branch3/... //depot/dev/project/branch1/... //depot/dev/sub-project/branch4/... //depot/dev/project/master/... //depot/patch-project/branch5/... //depot/patch-project/branch5/... //depot/patch-project/special/developern/branch6 </code></pre> <p><strong>git-p4 config items:</strong> Next, I setup an empty git repository and following config items.</p> <pre><code> mkdir workdir cd workdir git init </code></pre> <p>(** perforce variables)</p> <pre><code>git config git-p4.user myp4user git config git-p4.passwowrd myp4password git config git-p4.port myp4port git config git-p4.client myp4client </code></pre> <p>(** force to use perforce client spec)</p> <pre><code>git config git-p4.useClientSpec true git config git-p4.client myp4client </code></pre> <p>( ** restrict to explore branchspecs created only by me)</p> <pre><code>git config git-p4.branchUser myp4user </code></pre> <p>( ** branch information, dependency relation, interestingly only last name (directory name in branch path) is required to mention, git-p4 automatically detects/pick what is required i.e. fully expanding the branch name )</p> <pre><code>git config git-p4.branchList master:branch1 git config --add git-p4.branchList master:branch2 git config --add git-p4.branchList branch1:branch3 git config --add git-p4.branchList branch1:branch4 git config --add git-p4.branchList master:branch5 git config --add git-p4.branchList branch5:branch6 </code></pre> <p><strong>Changelists file:</strong> Next, I collected all the changelists, for all branches those I am migrating.</p> <pre><code>p4 changes //depot/dev/project/master/... | cut -d' ' -f2 &gt;&gt; master.txt p4 changes //depot/dev/project/branch1/... | cut -d' ' -f2 &gt;&gt; master.txt p4 changes //depot/dev/project/branch2/... | cut -d' ' -f2 &gt;&gt; master.txt p4 changes //depot/dev/sub-project/branch3/... | cut -d' ' -f2 &gt;&gt; master.txt p4 changes //depot/dev/sub-project/branch4/... | cut -d' ' -f2 &gt;&gt; master.txt p4 changes //depot/patch-project/branch5/... | cut -d' ' -f2 &gt;&gt; master.txt p4 changes //depot/patch-project/special/developern/branch6/... | cut -d' ' -f2 &gt;&gt; master.txt sort -n master.txt | uniq &gt; master_sorted.txt </code></pre> <p><strong>Import:</strong> Finally I ran the import as below, I used "sync" and not clone.</p> <pre><code>cd workdir ../git-p4.py sync //depot/... --detect-branches --verbose --changesfile /home/myp4user/master_sorted.txt </code></pre> <p><em>On smaller depots “ ../git-p4.py sync //depot@all --detect-branches --verbose “ shall also work, in that case no need to create changelists file (earlier step)</em></p> <p><strong>Once import is finished, I am able to see git-p4 created all remote perforce branches inside single git repository.</strong></p> <pre><code> git branch -a remotes/p4/depot/dev/project/master remotes/p4/depot/dev/project/branch1 remotes/p4/depot/dev/dev/project/branch2 remotes/p4/depot/dev/dev/sub-project/branch3 remotes/p4/depot/dev/dev/sub-project/branch4 remotes/p4/depot/patch-project/branch5 remotes/p4/depot/patch-project/special/developern/branch6 </code></pre> <p><strong>Then I created local branches from remote p4 branches</strong></p> <pre><code> git checkout -b master remotes/p4/depot/dev/project/master git checkout -b branch1 remotes/p4/depot/dev/project/branch1 git checkout -b branch2 remotes/p4/depot/dev/dev/project/branch2 git checkout -b branch3 remotes/p4/depot/dev/dev/sub-project/branch3 git checkout -b branch4 remotes/p4/depot/dev/dev/sub-project/branch4 git checkout -b branch5 remotes/p4/depot/patch-project/branch5 git checkout -b branch6 remotes/p4/depot/patch-project/special/developern/branch6 </code></pre> <p><strong>Next I simply added a remote origin and pushed the code into git repo.<br> Thanks for various pointers/help available in stackoverflow and online.</strong></p>