Difference between revisions of "Version control with Git"

From Geos-chem
Jump to: navigation, search
(Overview)
(Redirected page to Guide to using Git with GEOS-Chem)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Overview ==
+
#REDIRECT [[Guide to using Git with GEOS-Chem]]
 
+
=== Why use Git? ===
+
 
+
GEOS–Chem model development is done in a distributed manner. [http://acmg.seas.harvard.edu/geos/geos_people.html Individual users from several different institutions] will download a recent GEOS–Chem version and modify it according to their own particular research interests. When these source code modifications are deemed to be mature, users will then submit them to the GEOS–Chem Support Team for inclusion into the [[GEOS-Chem versions under development|mainline "standard" model]].
+
 
+
In the past, the GEOS–Chem source code and run directories were distributed to the user community as a series of TARBALL (i.e. *.tar.gz) files via anonymous FTP. The advantage of this method was that one would only have to download a single file. However, as the number of GEOS–Chem users (and submitted source code modifications) grew, this method became unwieldy. For example, if only a single file needed to be updated, the entire TARBALL file would have to be regenerated. This often became a source of confusion and error.
+
 
+
Given the large number of user code submissions, robust source code management techniques must be employed in order to ensure the integrity of the GEOS–Chem code. Therefore, the [[GEOS-Chem Support Team]] has selected the [http://www.git-scm.com Git version control software] for GEOS–Chem source code management.
+
 
+
=== Advantages of using Git ===
+
 
+
Git offers many improvements over previous source code management software such as [http://cvsbook.red-bean.com/cvsbook.html CVS] and [http://subversion.apache.org/ Subversion].
+
 
+
#Git avoids some of the [http://stackoverflow.com/questions/802573/difference-between-git-and-cvs limitations of CVS] (which is by now 20-year-old software).
+
#*Git is a distributed source code management system. Instead of having one central GEOS–Chem repository residing on a single server, Git allows you to keep an identical copy (a.k.a. "clone") of the GEOS–Chem source code repository on your own system. Having several copies of the GEOS–Chem repository allows for redundancy in case of catastrophic server failure or other such calamity.
+
#*Modifications that you make to your own repository will not affect the repositories of other users. (That is, unless you consciously decide to "push" your changes to another repository).
+
#*When you are ready to submit your source code modifications for inclusion into the "standard" code, the GEOS–Chem Support Team can simply get them with a Git "pull" operation.
+
#*Git allows you to save out your source code changes to a "patch" file (a text file with a list of source code differences). This can be emailed to other users and applied to their local source code repository.<br><br>
+
#In general, Git is much simpler to use than CVS.
+
#*With Git, you can "pull" changes from other users directly into your own local source code repository.
+
#*With Git, you can easily create several branches off of code development of the "master" branch. (Branching was always problematic in CVS).
+
#**Each branch can hold a new "feature", which may be tested independently of the rest of the code. 
+
#**Branches can be merged back into the "master" branch when the new feature has been validated.
+
#*The Git repository browser, called GitK, allows you to see every single line of code that has been modified, going all the way back to the start of the project.
+
#*A graphic user interface, called the Git Gui, lets you control Git in a visual manner rather than using command-line options.<br><br>
+
#With Git, GEOS–Chem developers are able to:
+
#*download the most current GEOS–Chem source code online.
+
#*download the most current GEOS–Chem run directories online.
+
#*develop and test their source code additions to GEOS–Chem in their own local repository.
+
#*submit their mature source code updates back to the [[GEOS-Chem Support Team]] for inclusion in the standard mainline code (via "Git pull" or patch files).
+
 
+
== Tutorials about Git ==
+
 
+
Here are some useful resources for learning the various Git commands:
+
 
+
=== For beginners ===
+
 
+
; [http://gitref.org/ GitRef.org (the Git Reference)]: An overview of the basic Git commands.
+
;[http://excess.org/article/2008/07/ogre-git-tutorial/ Git tutorial video]: Excellent lecture given by Bart Trojanowski for the Ottawa Group of Ruby Enthusiasts.  '''''HIGHLY RECOMMENDED!'''''
+
;[http://hoth.entp.com/output/git_for_designers.html Git for Designers]: Nice overview of how version control works.  Recommended for people with no prior experience using a version control system.
+
;[http://www.spheredev.org/wiki/Git_for_the_lazy Git for the Lazy]: This is an excellent Git guide for beginners.  Short, sweet, and to the point.
+
;[http://people.seas.harvard.edu/~lars/workshops/version-control-workshop/ Overview of Git and Subversion]: Presentation given by the School of Engineering and Applied Sciences at Harvard.
+
 
+
=== For more advanced users ===
+
 
+
;[http://progit.org/book/ ''ProGit'']: Excellent online book that discusses many of Git's features, and how to use them like a pro.
+
;[http://ftp.newartisans.com/pub/git.from.bottom.up.pdf ''Git From the Bottom Up'' by John Wiegley]: Article which not only describes the commands used to invoke Git but also the design philosophy behind the Git version control system.  Good theoretical background but somewhat terse for beginners to understand.
+
;[http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html Official Git tutorial]: A comprehensive but somehwat terse tutorial of Git commands.
+
;[http://www-cs-students.stanford.edu/~blynn/gitmagic/ GitMagic]: Descriptive online book that goes into the nitty-gritty of Git usage.  A worthwhile read!
+
;[http://www.kernel.org/pub/software/scm/git/docs/v1.4.4.4/cvs-migration.html Git for CVS Users]: A tutorial specifically geared toward migrating from CVS to Git.
+
;[https://rails.lighthouseapp.com/projects/8994/sending-patches Sending Patches with Git]: A guide how to use the patch feature of Git to send your changes to another user.
+
;[http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/ How to create and apply a patch with Git]: Another nice explanation of how to use Git to send patch files.
+
 
+
== Using Git with GEOS-Chem and GAMAP ==
+
 
+
=== Obtaining and installing Git ===
+
 
+
If you don't already have Git on your system then you (or your sysadmin) will have to install it.  To check if it is already installed, you can ask for the version at the Unix prompt.  Type:
+
 
+
[534 rhea GEOS_5]% git --version
+
 
+
If you get a string similar to:
+
 
+
git version 1.6.6.2
+
 
+
then you are good to go.  (The actual version # doesn't matter.)  If not, then you (or your sysadmin) may obtain the Git source code (or binaries) [http://git-scm.com/download the Git website].
+
 
+
=== First-time setup ===
+
 
+
Before using Git for the first time, you need to set up your <tt>~/.gitconfig</tt> file.  Open a text editor and then cut & paste the text from [http://docs.scipy.org/doc/numpy-1.6.0/dev/gitwash/configure_git.html this sample <tt>.gitconfig</tt> file].  Then save it as <tt>~/.gitconfig</tt>. 
+
 
+
Be sure to change your name and email accordingly, this is how Git will know who you are!
+
 
+
Please see the following pages which describe how to download the GEOS-Chem and GAMAP source code packages via Git.
+
 
+
=== Downloading GEOS-Chem and GAMAP ===
+
 
+
Please see the following wiki pages which contain detailed information about how to use Git to download and modify the GEOS-Chem and GAMAP source code packages:
+
 
+
* [[Using Git with GEOS-Chem]]
+
* [[Using Git with GAMAP]]
+
 
+
--[[User:Bmy|Bob Y.]] 09:43, 16 March 2010 (EDT)
+
 
+
== References ==
+
 
+
# [http://git-scm.com/ Git web page]
+
# [http://zrusin.blogspot.com/2007/09/git-cheat-sheet.html Git Cheat Sheet]
+
# Google "Tech Talk" by Linus Torvalds, the creator of Git [http://www.youtube.com/watch?v=4XpnKHJAok8 (Video on Youtube)]
+
# Google "Tech talk" by Randal Schwartz [http://www.youtube.com/watch?v=8dhZ9BXQgc4 (Video on Youtube)]
+
# Setting up your <tt>.gitconfig</tt> file [http://stackoverflow.com/questions/267761/what-does-your-gitconfig-contain (Link)]
+
 
+
--[[User:Bmy|Bob Y.]] 15:35, 26 January 2011 (EST)
+

Latest revision as of 17:26, 21 June 2019