Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Git for Administrators.

Git for Administrators: Difference between revisions

From MoodleDocs
No edit summary
m (Fixed instructions for git-checkout, reformatted)
Line 1: Line 1:
{{stub}}
{{stub}}


An alternative way for maintaining your Moodle server via [[CVS_for_Administrators]] is using Git.
An alternative way to maintaining your Moodle server via [[CVS for Administrators|CVS]] is using Git. This page describes how to maintain a copy of Moodle on your production server, that is easy to upgrade using Git. If you have customisations of Moodle core code, you are advised to follow the instructions in [[Development:Quick Git start guide for Moodle development|this start guide]].


==Purpose of this article==
== Getting the code from Git ==
The purpose of this articla is to describe how to maintain a copy of Moodle on your production server, that is easy to upgrade using Git. If you have customisations of Moodle core code, you are advised to follow the instructions on [[Development:Quick_Git_start_guide_for_Moodle_development]]


==Where are the files==
You can find the official Moodle git repository at git://git.moodle.org/moodle.git and git://github.com/moodle/moodle.git. To initialize your local checkout, use
You can find the official Moodle git repository on git://git.moodle.org/moodle.git and git://github.com/moodle/moodle.git


==Initial download of the Moodle code==
    git clone git://github.com/moodle/moodle.git                    (1)
    cd moodle
    git branch -a                                                  (2)
    git checkout -b MOODLE_19_STABLE origin/MOODLE_19_STABLE        (3)


<code>git clone git://github.com/moodle/moodle.git</code>
The command (1) initializes new local repository as a clone of upstream moodle.git repository. The command (2) lists all available branches. Use the command (3) to switch to a different branch than the default 'master'.


==Moving to the correct version of Moodle==
== Updating your installation ==
(only if you need something else then master)


* List all existing branches
Moodle development team performs integration and testing of fixed bugs every Monday and Tuesday. On Wednesday you can install all patches by updating your code. Check the [http://git.moodle.org/gw?p=moodle.git;a=summary shortlog] to see if the official repository has been already updated or not.


<code>git branch -a </code>
    cd /path/to/your/moodle/checkout
    git pull


* Move to the desired branch
== Important note ==


<code>git checkout BRANCHE_NAME</code>
At the moment, master branch represents Moodle 2.0.x stable code. It is wise to do a <code>git branch -a</code> before a <code>git pull</code> to see whether Moodle 2.0 isn't branched. If Moodle 2.0 gets branched and you are still on master, you will be updating to the latest development version, which is not desirable on a production server. This is an exception caused by the transition from CVS to Git and should not never happen again.
 
Now your code base is on the correct version
 
==Updating your installation==
 
Moodle.com performs testing and integration of fixed bugs every Tuesday, so on Wednesday you can install all patches by updating your code.
 
<code>git pull</code>
 
==Important note==
 
At the moment, master is Moodle 2.x stable. It is wise to do a <code>git branch -a</code> before a <code>git pull</code> to see whether Moodle 2.0 isn't branched. If Moodle 2.0 gets branched and you are still on master, you will be updating to the latest development version, which is not desirable on a production server.


[[Category:Git]]
[[Category:Git]]
[[Category:Administrator]]
[[Category:Administrator]]

Revision as of 16:08, 14 February 2011


An alternative way to maintaining your Moodle server via CVS is using Git. This page describes how to maintain a copy of Moodle on your production server, that is easy to upgrade using Git. If you have customisations of Moodle core code, you are advised to follow the instructions in this start guide.

Getting the code from Git

You can find the official Moodle git repository at git://git.moodle.org/moodle.git and git://github.com/moodle/moodle.git. To initialize your local checkout, use

   git clone git://github.com/moodle/moodle.git                    (1)
   cd moodle
   git branch -a                                                   (2)
   git checkout -b MOODLE_19_STABLE origin/MOODLE_19_STABLE        (3)

The command (1) initializes new local repository as a clone of upstream moodle.git repository. The command (2) lists all available branches. Use the command (3) to switch to a different branch than the default 'master'.

Updating your installation

Moodle development team performs integration and testing of fixed bugs every Monday and Tuesday. On Wednesday you can install all patches by updating your code. Check the shortlog to see if the official repository has been already updated or not.

   cd /path/to/your/moodle/checkout
   git pull

Important note

At the moment, master branch represents Moodle 2.0.x stable code. It is wise to do a git branch -a before a git pull to see whether Moodle 2.0 isn't branched. If Moodle 2.0 gets branched and you are still on master, you will be updating to the latest development version, which is not desirable on a production server. This is an exception caused by the transition from CVS to Git and should not never happen again.