Difference between revisions of "Github"

From WeBWorK_wiki
Jump to navigation Jump to search
Line 31: Line 31:
   
 
=== Following WeBWorK Development ===
 
=== Following WeBWorK Development ===
You can get a view of development using git by clicking on the "Network" button on a github site. For example at
+
You can get a view of development using git by clicking on the "Network" button on a github site.
https://github.com/mgage/webwork2 click on the "Network" button to see a graph of changes incorporated into Mike Gage's (bleeding edge) version
+
For example at https://github.com/mgage/webwork2 click on the "Network" button to see a graph of changes incorporated into Mike Gage's (bleeding edge) version
of WeBWorK.
+
of WeBWorK. Clicking on the commit dots along the lines will show the commit comments describing what was done with this commit. With git you concentrate on the "dots" the individual commits, more than the branch lines. You can often grab individual commits and apply them to your own branch; cherry picking some features for your branch while leaving other features behind. Your branch and the branch you are borrowing from must have a shared history somewhere in the past. Having a fairly recent shared history minimizes the chances that there will be conflicts when you try to apply the commit or "patch".
 
 
   
   
  +
You can scroll the network graph to explore the past history of WeBWorK and when (and to some extent by who) each feature was added. Please follow or improve on the style of the later commit comments. Earlier commits represent a learning phase. :-)
   
 
=== Contributing to WeBWorK ===
 
=== Contributing to WeBWorK ===

Revision as of 12:13, 6 March 2012

Warning : This page is still under construction use with caution


GitHub

Overview

Git is the name of a distributed version control system. It plays the role of the CVS or SVN control systems that WeBWorK has used in the past but the details of how it works are somewhat different. For obtaining up-to-date copies of software there is not much difference between git and previous VCS. Developers however should read closely since git has a different conceptualization of how version control should be handled. The difference allows considerably more flexibility for collaborative development. Consolidation no longer depends on a single site or single administrator. Updates are also more modular and therefore easier to check and repair or remove if they cause trouble.


Git has many capabilities and can be used in many different ways. This page outlines a subset of git commands and workflows that seems to work well for WeBWorK.


Github.com is a site which facilitates the collaborative development of open source projects. These sites are open (read-only) to the world. WeBWorK has a master site at https://www.github.com/openwebwork where accepted modifications are being consolidated. The following repositories are available at that site.

  • webwork2 -- the course management face of WeBWorK
  • pg -- the macros that help render the PG questions
  • NationalProblemLibrary -- collection of questions (not yet implemented -- for now Jason Grout's repository at:
  • wwmoodle -- plugins that connect moodle and webwork
  • ww_question_server -- another plugin project connecting moodle question types to the WeBWorK webservice
  • admintools -- a collection of command line scripts used by larger sites serving WeBWorK


Following WeBWorK Development

You can get a view of development using git by clicking on the "Network" button on a github site. For example at https://github.com/mgage/webwork2 click on the "Network" button to see a graph of changes incorporated into Mike Gage's (bleeding edge) version of WeBWorK. Clicking on the commit dots along the lines will show the commit comments describing what was done with this commit. With git you concentrate on the "dots" the individual commits, more than the branch lines. You can often grab individual commits and apply them to your own branch; cherry picking some features for your branch while leaving other features behind. Your branch and the branch you are borrowing from must have a shared history somewhere in the past. Having a fairly recent shared history minimizes the chances that there will be conflicts when you try to apply the commit or "patch".


You can scroll the network graph to explore the past history of WeBWorK and when (and to some extent by who) each feature was added. Please follow or improve on the style of the later commit comments. Earlier commits represent a learning phase. :-)

Contributing to WeBWorK

Workflow

On your local git repository the following workflow seems to minimize clashes with work being done elsewhere. Commit early and often to your local branch.


clone the remote repo
git checkout -b my_new_feature (start a new branch to work on a single feature)
 ..work and commit some stuff
git pull origin master    (pull changes from the upstream github repository into your master copy)
git rebase master         (apply updates to your my_new_feature branch so that it looks like it branched from the updated master copy)
 ..work and commit some stuff
git pull origin master 
git rebase master
 ..finish the feature
git checkout master
git merge my_new_feature  (merge your changes back into your local master copy)
git push origin master    (publish the changes in your master copy to your github account)
Issue pull request to openwebwork

Individual developers for webwork also have their own sites (analogous to the branches in SVN, but more easily accessible)


Writing a good commit line

When making commits I found this advice to be useful.

  • Write a good first line, (like the subject line of an email) that describes what you did. This is the line that summarizes the commit so that when searching the commit tree one can find where a feature was added.
  • Good style: Start with a verb in the present tense. These read well in the commit tree. For example:
Add slider bar to library browser.
or
Fix bug in level_curve_checker  subroutine
  • Follow the subject line with a blank line.
  • Then add as much as you want to explain what changes were made and any other information you want preserved. (A diff of the changed files is preserved automatically.)
  • You can use git log to see how previous commits were worded. (Don't copy any of my first examples, but the later ones are getting better.)

References for GitHub and Git

(unreviewed at the moment -- YMVV)


Version_Control