Aquesta pàgina forma part de la documentació de Moodle en català, tot i que no ha estat traduïda encara. Podeu contribuir obertament a les tasques de traducció. Podeu consultar la Guia d'edició de la documentació i també participar ens els debats del fòrum de traductors de la documentació a moodle.org

Maintaining Moodle customisations with Git: diferència entre les revisions

De MoodleDocs
Salta a:navegació, cerca
Cap resum de modificació
(Replaced content with "{{Moved_to_dev_docs}}")
 
(6 revisions intermèdies per 2 usuaris que no es mostren)
Línia 1: Línia 1:
Git makes it very easy to maintain local customisations to Moodle alongside updates from the official Moodle repository.
{{Moved_to_dev_docs}}
This page assumes you installed Moodle following [[Installing Moodle from Git repository]]. It also assumes you understand basic version control principles (repositories, branches, conflicts) and have a basic working knowledge of Git.
 
From your moodle directory, create a new branch for developing your customisation, and move to that branch:
git checkout -b myfeature
 
Switched to a new branch 'myfeature'
This will give you a seperate copy of the Moodle code to work on without affecting the master branch. It's not recommended that you do this on your production server, as it will cause the code to be available immediately as it's saved.
 
Do your customisations, add any new files to git, and commit the changes
git add .
git status
git commit -m "Description of the change"
 
''Ouch! this next bit is a really bad idea. I don't know what you are trying to achieve, but this is not the right way to do it!!!--[[User:Tim Hunt|Tim Hunt]] 09:09, 15 March 2011 (UTC)''
Switch back to the master branch and merge the changes
git checkout master
git merge myfeature
Any future development can take place on the myfeature branch, and be merged into master in this way
 
Even after local modifications have been made, you can pull in updates from the official git repository
git checkout master
git fetch
git merge origin/master
 
=== Conflicts ===
If you create a local modification to a file, and that same file is modified in the official repository, you may find that a conflict is created when you do <tt>git merge origin/master</tt>.
 
To resolve this, you will need to find the conflicts (the attempt to merge will tell you where they are) and resolve them.  The [http://www.kernel.org/pub/software/scm/git/docs/git-merge.html|<tt>git merge</tt> man page] has more information on the presentation and resolution of conflicts.
 
After the conflict is resolved, you'll need to commit the resolved files.
git commit -a

Revisió de 08:48, 16 juny 2011

This development related page is now located in the Dev docs.

See the Maintaining Moodle customisations with Git page in the Dev docs.