Software for Liquid Argon time projection chambers
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:
The LArSoft repositories are owned by the LArSoft organization on Github
In order to develop and contribute LArSoft code, you will need to have a personal GitHub account.
git config --global user.name "<First Name> <Last Name>"
git config --global user.email <Your-Email-Address>
git config --global user.github <Your-GitHub-Account-Username>
The ‘mrb gitCheckout
’ command has been updated to work with Github.
mrb gitCheckout --repo-type github <larsoft respository>
mrb
checkout commands, specifying larsoft_suite
as the repository will check out all LArSoft repositories.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:
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
cd $MRB_SOURCE/<repo name>
hub fork --remote-name=origin
cd $MRB_SOURCE
mrb gitCheckout --repo-type github --fork <repository name>
hub pull-request -m MESSAGE [--edit] [--base <target-branch>] [--head <source-branch>]
The target-branch
defaults to develop
for LArSoft repositories. The source-branch
defaults to the currently checked out branch.
hub pr checkout <PR-NUMBER> [<BRANCH>]
where BRANCH
is a new branch into which the PR will be placed.
For additional examples of using hub
, see:
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>
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
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.