Difference between revisions of "ROOT Analyzer/Git"
(→Git References) |
(Updates for new hallc git server) |
||
Line 28: | Line 28: | ||
== Retrieving the Hall C analyzer skeleton with git == | == Retrieving the Hall C analyzer skeleton with git == | ||
− | The Hall C code is hosted on github.com at [https://github.com/sawjlab/hcana] | + | The Hall C code is hosted on hallcgit.jlab.org. There is also a read-only mirror on github.com at [https://github.com/sawjlab/hcana]. To retrieve the code, follow one of the two sections below: |
+ | |||
+ | === Read-only access === | ||
To retrive the Hall C code with git, do | To retrive the Hall C code with git, do | ||
Line 34: | Line 36: | ||
git clone git://github.com/sawjlab/hcana.git | git clone git://github.com/sawjlab/hcana.git | ||
− | ( | + | (Because of firewalls, this will not work on ifarm machines, use your own machine or a jlabl machie.) |
+ | |||
+ | === Read/write access === | ||
+ | |||
+ | The read-write git archive is hosted on hallcgit.jlab.org. Access to this server is by request only. Please send your public ssh key (id_dsa.pub) to Steve Wood who will install it on the server. Once that is done, do | ||
+ | |||
+ | git clone git@hallcgit.jlab.org:hcana.git | ||
+ | |||
− | + | Either of these two methodes 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 | 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 | ||
Line 77: | Line 86: | ||
== Branches == | == Branches == | ||
− | The | + | The git repository may contain several branches in addition to the default "develop" branch. These branches may be 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 pull origin #Updates the local repo from the public repo | ||
Line 90: | Line 99: | ||
== Publishing Changes == | == Publishing Changes == | ||
− | It is important that any code development be made public early and often. | + | It is important that any code development be made public early and often. If you have previously retrieved the analyzer from github, you need to change to the hallc git server to be able to push code. 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@ | + | url = git@hallcgit.jlab.org:hcana.git |
Github will have to be told to allow access from your account. To do this, contact Steve Wood. | Github will have to be told to allow access from your account. To do this, contact Steve Wood. |
Revision as of 12:16, 18 September 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.
Some general information on how to work with git can be found on the Git Howto page.
Contents
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. 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 hallcgit.jlab.org. There is also a read-only mirror on github.com at [1]. To retrieve the code, follow one of the two sections below:
Read-only access
To retrive the Hall C code with git, do
git clone git://github.com/sawjlab/hcana.git
(Because of firewalls, this will not work on ifarm machines, use your own machine or a jlabl machie.)
Read/write access
The read-write git archive is hosted on hallcgit.jlab.org. Access to this server is by request only. Please send your public ssh key (id_dsa.pub) to Steve Wood who will install it on the server. Once that is done, do
git clone git@hallcgit.jlab.org:hcana.git
Either of these two methodes 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 git repository may contain several branches in addition to the default "develop" branch. These branches may be 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. If you have previously retrieved the analyzer from github, you need to change to the hallc git server to be able to push code. 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@hallcgit.jlab.org: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
Brad's Hall C wiki Git_Howto page
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