LArSoft

Logo

Software for Liquid Argon time projection chambers

View My GitHub Profile

Working With LArSoft Github Repositories

This page is for LArSoft users who need to check out LArSoft repositories from GitHub, and for those who need to commit changes back to LArSoft. The latter requires creation of a pull request from a personal GitHub account.

In the following:

Where are the primary LArSoft repositories?

The LArSoft repositories are owned by the LArSoft organization on Github

How do I join GitHub and configure my personal GitHub account?

In order to develop and contribute LArSoft code, you will need to have a personal GitHub account.

How do I check out LArSoft repositories from GitHub?

The ‘mrb gitCheckout’ command has been updated to work with Github.

How do I submit changes to the LArSoft GitHub repository?

Only a small number of people (the Level 1 managers) can push to the upstream LArSoft repository on GitHub. Changes from general users are made by:

  1. creating a fork of the upstream repository(ies) in your personal GitHub account (a one-time operation)
  2. creating a local repository by cloning the upstream repository or personal fork
  3. committing changes to the local repository and pushing them to your personal repository
  4. submitting a pull request to the upstream repository.

To assist with the various GitHub operations needed, you can use hub, a command-line utility that performs GitHub operations from local repositories. hub can, for instance, fork the upstream repositories to your GitHub account, or create pull requests from your local repositories. It is packaged as a dependency of the latest MRB, so is available whenever MRB is set up. More information on hub can be found at hub.github.com.

The GitHub CLI, gh, is now available as an alternative to hub. See this talk for more info.

Before executing any of the steps below, these commands must be run in the current login session:

setup mrb
source localproducts*/setup

For additional examples of using hub, see:

What do I do if there is a problem with the pull request?

The most common problem initially, may be a code check failure due to trailing whitespace. The failure message will provide instructions for fixing the problem. Only files that you have changed will be checked for trailing whitespace. Run removeWhiteSpace.sh (found in larsoft) on the problematic files.

    removeWhiteSpace.sh myfile.cxx myfile.h

Once the problem has been addressed, commit the changes, and push your feature branch to origin again.

    git commit -m"some message" <my files>
    git push origin <my feature branch>

How do I update an existing fork?

If you already have a fork of one of the LArSoft GitHub repositories, you will need to regularly pull changes from the upstream LArSoft repository. However, when you clone an existing fork, it will not reference the upstream repository. You need to add that yourself.

    git clone https://github.com/<github_identity>/<larsoft_package>.git
    cd <larsoft_package>
    git remote add upstream  git@github.com:LArSoft/<larsoft_package>.git
    OR
    git remote add upstream https://github.com/LArSoft/<larsoft_package>.git

To merge upstream changes in develop with your develop branch:

    git checkout develop
    git pull upstream develop

How do I create a merge request for a legacy feature branch that existed prior to the migration to GitHub?

These instructions are no longer relevant for LArSoft repositories since the code has diverged significantly. We retain these instuctions in case they are relevant to other efforts.

The GitHub repositories have commit histories that have been cleaned of old commits (ca. 2014), and all feature branches at the time of the migration. Because their commit histories have been rewritten, you cannot submit pull requests to develop from any legacy branch that existed prior to the migration, and therefore contains the old commit history.

For instructions on how to alter the histories of these branches so that they can be merged with the GitHub repositories, see the instructions on the Migrating_Redmine_Feature_Branches page.