Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

User:Gerard Caulfield/Fast Moodle git setup: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 43: Line 43:
<code bash>
<code bash>
git remote add yourGithubUsername git@github.com:yourGithubUsername/moodle.git
git remote add yourGithubUsername git@github.com:yourGithubUsername/moodle.git
</code>
If you have a repository that is local to you which contains a copy of moodle you can fetch from that first. The more recent it is the better.
<code bash>
git remote add local /media/myUsbDrive/prettyOldMoodleRepository/
git fetch local
git remote rm local
<code>
If you did the step above first then git will not need to download any commit objects it already has and so the entire process will go a lot quicker. Fetch everything from the r_int and r_pro repositories. Don't try doing both at the same time as they mostly contain the same data so it may end up trying to download the same thing twice (although I haven't checked).
<code bash>
git fetch r_int
git fetch r_pro
</code>
</code>

Revision as of 07:04, 27 February 2012

This setup allows you to have multiple working directories while having them all linked and using the same repository which I believe is perfect for Moodle development where you sometimes want to view several versions of moodle at the same time but managing all those instances seperatly is an unnecessary hassle.

First create all the necessary directories:

  1. Data directories

mkdir -p ~/data/moodle/int/m/ ~/data/moodle/int/22/ ~/data/moodle/int/21/ ~/data/moodle/int/20/ ~/data/moodle/int/19/ \ ~/data/moodle/pro/m/ ~/data/moodle/pro/22/ ~/data/moodle/pro/21/ ~/data/moodle/pro/20/ ~/data/moodle/pro/19/

  1. Code directories

mkdir -p ~/src/moodle/int/m/ ~/src/moodle/int/22/ ~/src/moodle/int/21/ ~/src/moodle/int/20/ ~/src/moodle/int/19/ \ ~/src/moodle/pro/m/ ~/src/moodle/pro/22/ ~/src/moodle/pro/21/ ~/src/moodle/pro/20/ ~/src/moodle/pro/19/

  1. The seed directory

mkdir ~/src/moodle/.seed/

Create a symbolic link in your web root so you can access all of these directories via http://localhost/moodle/ (or whatever location you prefer) sudo ln -s ~/src/moodle /var/www/moodle

Create the .seed repository for all the other working directories: cd ~/src/moodle/.seed/ git init Turn on colorisation and ignore file permission changes git config core.ui auto git config core.filemode false Set yourself as the default author of commits to the repository (you will need to replace the name and email used in the following two example commands) git config user.name 'John Doe' git config user.email johndoe@example.com Add Moodle remotes for Integration and Production (fyi: some people refer to production as "stable", but the word stable is used in integration branche names, so I think production is a better term for this remote). I have added "r_" to the front of the remote names so that there is no ambiguity. Without this in some instances git will not be able to tell if we mean the remote "int" or the folder "int". For the production repository we have used the name "moodle.git", instead of describing it's use case like we did for "integration.git". I can't be sure but I imagine this is done for sites like github, where the repository name is how people find your project, so labeling the repository "production.git" would have make it difficult for people to locate the repository in a search. However I suggest while working on it you think of it as the production repository instead of the moodle repository to keep thing consistent and it's purpose clear. git remote add r_pro git://git.moodle.org/moodle.git git remote add r_int git://git.moodle.org/integration.git If you have a github account you will probably also wish to add a remote for that so you can push changes to it as a public storage location for your changes that you can then link to in Moodle tracker issues. First you need to fork the moodle repository on github. After doing that you can add a remote to it as shown below, remembering to replace yourGithubUsername with your actual github username git remote add yourGithubUsername git@github.com:yourGithubUsername/moodle.git If you have a repository that is local to you which contains a copy of moodle you can fetch from that first. The more recent it is the better. git remote add local /media/myUsbDrive/prettyOldMoodleRepository/ git fetch local git remote rm local If you did the step above first then git will not need to download any commit objects it already has and so the entire process will go a lot quicker. Fetch everything from the r_int and r_pro repositories. Don't try doing both at the same time as they mostly contain the same data so it may end up trying to download the same thing twice (although I haven't checked). git fetch r_int git fetch r_pro