Narrow cloning with GitSwarm accelerates your workflow by enabling you to specify portions of a Helix depot to clone a tailored Git repo. This reduces cloning, fetch times and disk usage since you can customize your cloning activity to get only the files you require.
We want to setup a narrow clone of the current Talkhouse project to use in GitSwarm. Specifically the widget folder in main-dev. To do this, we will configure a new project in GitSwarm to map this directory from Helix to create our repo.
Here, we have logged into GitSwarm as user Joe Coder. Next, we select New Project.
On the new project screen, we will give it the name talkhouse-search, which will double as the path.
Next, we will click on “Select directories to mirror.” Let’s name this branch “master” and then navigate to the folder we want to clone. In this case, the widget folder in this portion of talkhouse/main-dev.
Next, we hit the "Add Branch master" button on the bottom of the navigation box and we see the branch definition appear here.
If we chose the wrong folder, we could edit the entry by selecting a different folder or just delete it all together.
You have the option to add multiple branches to a project. Just give each one a new name here and select the relevant folder to add as we just completed. Let’s add the widget folder in the rel1.0 branch of talkhouse. And call it "rel1.0".
Next, we’ll enter “new search function” as the description of the project and we will make it an Internal project.
After the setup is complete, we navigate over to the Files page and see only the subset of the 4 files from main-dev have been cloned into the master branch. By selecting the rel1.0 branch from the dropdown we can see the three files cloned from that part of the depot. Clicking on the commit link, we can history related to these files.
Any changes made to these files are mirrored bidirectionally between GitSwarm the Helix Depot. Let’s use P4V to look at the EBolt file in Talkhouse main-dev. Here we see this package declaration followed by some code.
Going back into GitSwarm, we edit the same EBolt file by adding a copyright here. We write “Add copyright” in the commit message box, use the master branch, and commit the changes.
When we go back to P4V to view the Helix depot, we see there is a new version so we sync the workspace.
A quick diff shows us the new file where the copyright was added, and we can see the commit message here along with other relevant Git metadata.
Any changes made to the version in the Helix depot would also be copied back into GitSwarm.
This concludes the overview of narrow cloning in GitSwarm. If you have any technical questions, please contact [email protected]
Thanks for watching.