Phil for Humanity Phil for Humanity
A Guide for the Survival of Humankind and Helping the World, Society, and Yourself.



Git Manifest File


A manifest file is basically just a list of repositories that can be downloaded with only two commands ("repo init .." and "repo sync ..") using a single tag or branch. And creating a new manifest is quite simple by following these instructions.

First, create a new manifest repository. I recommend making the repository's name have the project's name and the word "manifest" in it.

Second, create an empty manifest xml file. Again, I recommend the manifest's filename have the project's name and the word "manifest" in it too. Do not use the typical name of "default.xml".


Third, create an empty manifest file with this contents.

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

</manifest>

Next, define the remote locations where the repositories will be downloaded from.

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

<remote fetch="." name="origin"/>
<remote fetch="../ANOTHER_PROJECT_NAME" name="ANOTHER_PROJECT_NAME"/>

</manifest>

In this example, the project that has the manifest repository in it is called "origin".

Next, you can define some optional defaults, like this:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

<remote fetch="." name="origin"/>
<remote fetch="../ANOTHER_PROJECT_NAME" name="ANOTHER_PROJECT_NAME"/>

<default remote="origin" revision="BRANCH_NAME" sync-j="5"/>

</manifest>

Finally, add all of your repositories. Each repositories has its own project line like these examples.

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

<remote fetch="." name="origin"/>
<remote fetch="../ANOTHER_PROJECT_NAME" name="ANOTHER_PROJECT_NAME"/>

<default remote="origin" revision="BRANCH_NAME" sync-j="2"/>

<project name="REPOSITORY_NAME" groups="GROUP_NAME" revision="refs/tags/TAG_NAME" remote="ANOTHER_PROJECT_NAME" path="."/>
<project name="REPOSITORY_NAME_2" groups="GROUP_NAME_2" revision="BRANCH_NAME_2" remote="origin" path="."/>

</manifest>

And that's it. You now have created a manifest file. Don't forget to add it to source control and verify that it works as intended.

by Phil for Humanity
on 04/07/2020

Related Articles
 » Git Tag
 » Git Status
 » Git Repository Permissions