Difference between revisions of "ROOT Analyzer/Git"
(Change repository location to github) |
(How to publish) |
||
Line 84: | Line 84: | ||
The master branch is reserved for major releases. | The master branch is reserved for major releases. | ||
+ | |||
+ | == Publishing Changes == | ||
+ | |||
+ | It is important that any code development be made public early and often. The instructions for cloning the hcana code above only allow read only access. To setup the ability pushlish your work to the public repository, edit the file "hcana/.git/config". Find the sectioon <tt>[remote "origin"]</tt>. Then replace "url" line after it with | ||
+ | |||
+ | url = git@github.com:sawjlab/hcana.git | ||
+ | |||
+ | Github will have to be told to allow access from your account. To do this, contact Steve Wood. | ||
+ | |||
+ | To publish changes, make sure you are doing your work in a branch other than develop. When you are ready to post it, do | ||
+ | |||
+ | git push origin branchname | ||
+ | |||
+ | Then let Steve Wood know and he will merge your code into the develop branch. | ||
== Git References == | == Git References == |
Revision as of 09:39, 13 June 2012
It has been proposed that Hall C use the Git version control system to manage development of the Hall C 12 Gev analysis software. To start working with git, a public repository of a bare skeleton of a Hall C analyzer based on the Hall A PODD analyzer has been created.
Setting up Git
You should have git, with at least version 1.5.3 installed on your computer. Most linux systems will have git installed. https://cc.jlab.org/system/files/JLabWinCA-2011.crt Personalize git on your machine with
git config --global user.name "Firstname Lastname" git config --global user.email "your_email@youremail.com"
By default, git pops up the vi editor, for the user write comments when making commits. IWef you prefer emacs, do
git config --global core.editor "emacs"
Retrieving the Hall C analyzer skeleton with git
The Hall C code is hosted on github.com at [1]. The code can be retrieved with git using several different protocols. To start, we will use a read-only protocol that requires no passwords or permissions.
To retrive the Hall C code with git, do
git clone git://github.com/sawjlab/hcana.git
This will create a directory "hcana" containing a checked-out working copy of the "develop" branch and containing the revision history of the code.
The hcana project includes a git "submodule" containing the source code for the Hall A analyzer. The Hall A code is not automatically downloaded with the "git clone" command. Before proceeding, do
cd hcana git submodule init git submodule update
It seems to be important to also do
cd podd git checkout master cd ..
If you want to update your copy of the respository to the lastest public version, do
git pull
See Analyzer/Compiling and Analyzer/Running to try out the code.
Using Git to develop the analyzer
We need to have a workflow methodology for developing the Hall C analyzer. "Understanding the Git Workflow" and "Our Simple Git Workflow" have some discussion of straight forward workflows.
Basically if you want to develop the analyzer, clone the git archive as described above. Then create a private branch for yourself with
git checkout -b myprivatebranch
Then work on the code do git commit -a frequently. Don't worry about committing changes frequently. You will have the opportunity to clean up the revision history before pushing your changes to the public repository.
There are a variety of ways to share your work. If someone you want to share it with is on the same machine (and your files are readable), he can clone or pull from your archive. If your working directory is available on the web, then anyone can clone or pull from it. To put your changes in the public git repository, contact one of the code maintainers.
Branches
The public repository (https://hallcweb.jlab.org/git/hcana.git) may contain branches, either for different experiments, or for work in progress that a developer wants to share. To see what branches exist, type
git pull origin #Updates the local repo from the public repo git branch -a
from the directory you cloned the project into. For example, at the moment, there is a branch "simon-shower" which contains code being developed for the shower counters. This branch will be listed as "remotes/origin/simon-shower". To check this branch out, type
git checkout simon-shower
The master branch is reserved for major releases.
Publishing Changes
It is important that any code development be made public early and often. The instructions for cloning the hcana code above only allow read only access. To setup the ability pushlish your work to the public repository, edit the file "hcana/.git/config". Find the sectioon [remote "origin"]. Then replace "url" line after it with
url = git@github.com:sawjlab/hcana.git
Github will have to be told to allow access from your account. To do this, contact Steve Wood.
To publish changes, make sure you are doing your work in a branch other than develop. When you are ready to post it, do
git push origin branchname
Then let Steve Wood know and he will merge your code into the develop branch.
Git References
Git Magic: An online book about using Git.
The Git Community Book: The official book introducing Git.
Understanding the Git Workflow
We will try to follow the branching model described in: A successful Git branching model