Difference between revisions of "ROOT Analyzer/Git"

From HallCWiki
Jump to navigationJump to search
(Change repository location to github)
Line 15: Line 15:
 
   git config --global core.editor "emacs"
 
   git config --global core.editor "emacs"
  
 +
<!--
 
We will be pulling the git repository from hallcweb, so we must install the JLab web certificate authority root.  Get the latest certificate file ([https://cc.jlab.org/system/files/JLabWinCA-2011.crt JLabWinCA-2011.crt]) from [https://cc.jlab.org/JLabCAs] and put it somewhere.  Then tell git the location of the crt file with
 
We will be pulling the git repository from hallcweb, so we must install the JLab web certificate authority root.  Get the latest certificate file ([https://cc.jlab.org/system/files/JLabWinCA-2011.crt JLabWinCA-2011.crt]) from [https://cc.jlab.org/JLabCAs] and put it somewhere.  Then tell git the location of the crt file with
  
Line 22: Line 23:
  
 
   git config --global --global http.sslVerify 0
 
   git config --global --global http.sslVerify 0
 +
-->
  
 
== 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 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
 
To retrive the Hall C code with git, do
  
   git clone https://hallcweb.jlab.org/git/hcana.git hcana
+
   git clone git://github.com/sawjlab/hcana.git
  
The last word on the command line is the name of the directory that will be created.  Any directory name could be used.
+
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
 
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 43: Line 47:
 
   cd ..
 
   cd ..
  
 +
<!--
 
We are doing to do development in the "develop" branch, saving the "master" branch for major release.  To setup to track the development branch, do:
 
We are doing to do development in the "develop" branch, saving the "master" branch for major release.  To setup to track the development branch, do:
  
 
   git branch --track develop origin/develop
 
   git branch --track develop origin/develop
 
   git checkout develop
 
   git checkout develop
 +
-->
  
 
If you want to update your copy of the respository to the lastest public version, do
 
If you want to update your copy of the respository to the lastest public version, do
Line 73: Line 79:
 
   git branch -a
 
   git branch -a
  
from the directory you cloned the project into.  For example, at the moment, there is a branch "develop" which is where the code currently being developed resides.  This branch will be listed as "remotes/origin/develop".  To check this branch out, type
+
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 develop
+
   git checkout simon-shower
  
 
The master branch is reserved for major releases.
 
The master branch is reserved for major releases.

Revision as of 09:18, 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.

Git References

Git Magic: An online book about using Git.

The Git Community Book: The official book introducing Git.

Understanding the Git Workflow

Our Simple Git Workflow

Git flow used by GitHub

We will try to follow the branching model described in: A successful Git branching model