Using Git for PMML

Getting Started with Git for PMML

This is a brief guide to help you get started using Git to make changes to the PMML repository. This is part of the DMG/PMML change management process.

Prerequisite

In order to commit changes to the PMML Git repository, you need to have a SourceForge account with sufficient privileges.

Set Up

There a few steps you need to take before you can start using Git to work on PMML files.

Add your public key to your SourceForge account

Log in to your SF account, click on Account from the top right, and then on Services. You will see a "Edit SSH Keys for Shell/CVS". Click on it and you will get page where you can paste your public key.

Install Git

Download and install Git from the Git download page.

First time Git setup

Run the following commands

  • git config --global user.name "John Doe"
  • git config --global user.email johndoe@example.com
  • git config --global core.autocrlf input (Linux, Max users)
  • git config --global core.autocrlf true (Windows users)

Details and other configuration options can be found here and here.

Clone the PMML Repository

Run git clone ssh://username@pmml.git.sourceforge.net/gitroot/pmml/pmml. Make sure you replace username with your SF username. This will create a pmml directory. In there, you will find the cloned Git repository (pmml/.git) and the master branch as your working copy (in the directory pmml itself).

Examples using Git

Note: Some basic knowledge and understanding of Git would be really helpful. Going through chapters 1,2, and 3 (especially) of the Pro Git book) is strongly recommended. It's an easy and short read.

Work on an existing branch

To contribute work to an existing branch:

  1. Create a tracking local branch of the repo branch: This can be found by looking at the desired branch in sourceforge. Example: git clone ssh://username@git.code.sf.net/p/pmml/code pmml-code
  2. Edit files
  3. If you add files you need to run git add ..... and if you remove files run git rm ....
  4. Validate prehtml (see below)
  5. Commit your changes locally: git commit -a -m "first version of my new super proposal" (the -m parameter is your commit message)
  6. Push your changes to the remove branch: git push origin master

At any time you can run git pull to bring any new changes made on the remote branch since you started working on it.

Note that steps 2 through 5 can be repeated many times before you move on to step 6. In other words, you can commit locally changes in many iterations until you are ready to push them to SF.

Validating prehtml

Before you commit any changes, please make sure you have run the validation script at /bin/makeHTML.py. This will loop through all the prehtml files, check for consistency and if there are no errors, generate .html and .xsd. It relies on python v2.7 to run the script.

e-mail info at dmg.org