anyone had any experience updating moodle via GIT?
I've just installed GIT on our ubuntu server, went through the documentation here: [url=http://docs.moodle.org/23/en/Git_for_Administrators#Obtaining_the_code_from_Git]Git for Administrators - MoodleDocs[/url]
but when after i browse to the existing website where moodle 2.3 is running, and do git pull, i get: fatal: Not a git repository (or any of the parent directories): .git
any ideas?
Also how do I update the core files from a mdlfix, this one: [url=http://tracker.moodle.org/browse/MDL-34328?focusedCommentId=177036&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-177036][#MDL-34328] Browser Unresponsive when editing turned on for large courses Moodle 2.3+ - Moodle Tracker[/url]
thanks
Here is a sequence that seemed to work (replace MOODLE_23_STABLE with your preferred branch).
In your moodle directory:
- git init
If you have any contributed plugins or other customizations now is the time to add their paths to .git/info/exclude so that they are excluded from git.
- git remote add origin git://git.moodle.org/moodle.git
- git fetch --all --prune
- git branch --track MOODLE_23_STABLE origin/MOODLE_23_STABLE
- git add .
- git pull origin MOODLE_23_STABLE
- git checkout MOODLE_23_STABLE
- git branch -D master
hth
Git will not recognize a directory that was not created by git, since git does not have any information about where that directory came from. If you already have a copy of the code that was checked out by git, you can copy the .git (note the leading dot) directory from that directory, but note that it isn't from exactly the same version, git will think that you have modified the code. It's probably easier to just replace your existing directory with a new git checkout, and copy any modified/new files over.
What you need to do is rename your existing Moodle to moodle_old then follow this tutorial to help you set up your Moodle 2.3 branch using GIT. Once set up you can go throught the install process and use the config.php from moodle_old, and it should work.
All you do then each week is use GIT to update with git pull
Here is the tutorial link again...
http://docs.moodle.org/dev/User:Sam_Hemelryk/My_Moodle_Git_workflow
Further to my last comment, but referring to MDL-34328.
I assume that you are familiar with GIT to some extent? I know setting up Moodle is a whole new learning curve. But knowing how to use GIT is important, especially if you want to start adding patches and the like.
However to review some code that someone has added in order to fix a BUG in Moodle Tracker, then that's pretty easy if you have already FORKED Moodle into your GITHUB. If you haven't done that, then you are not quite ready to tackle merging patches. That is something quite different than cloning Moodle, so you have a working copy of Moodle on your localhost server, which is what the tutorial I left in the previous comment was all about.
Peer rieviewing someones works is really more in the development side and this takes time and practice to learn to do. But that said it is pretty straight forward to just got a copy of it on to you local repository.
If you read GIT for Developers and checkout Section7: Peer Reviewing someone else's code, you will find that explains how to do what you want to with MDL-34328
Mary
That and this discussion http://moodle.org/mod/forum/discuss.php?d=208904#p912389 helped me to complete http://docs.moodle.org/22/en/Installing_Moodle_on_Debian_based_distributions#Get_the_code -> Download via git.
I have been using GIT for a while now and dutifully been upgrading Moodle from GIT from 2.1, 2.2 and now 2.3.
But between each major version I get a TON of conflicts everything time I merge in the newest and greatest stable branches:
git checkout MOODLE_22_STABLE
git checkout -b moodle2
git merge --no-ff MOODLE_23_STABLE
I deal with the conflicts everytime, but now this procedure has bit me recently in terms of regression bugs. For example, there was a commit that was in Moodle 2.2.4 (MDL-30008) that wasn't in 2.3.1. So when I merged the latest stable branch and jumped from 2.2.4 to 2.3.1 this extra commit that wasn't in 2.3.1 remained.
Also, I am not sure if this is related, but I found that the commit related to MDL-33173 wasn't in my newly merged branch as well. Such very strange stuff.
How does everyone else upgrade their Moodle install from version to version? How do you deal with the conflicts and resulting weirdness of certain commits not being there or being there?
I don't have any local changes to my code to preserve so it's easy (from the start- after initial clone):
git branch -r (see the remote branch names)
git checkout -b origin/MOODLE_22_STABLE MOODLE_22_STABLE (I use the same local branch names as the remotes)
git reset --hard (just in case)
then to switch to 2.3 when it came out:
git pull
git branch -r (I like to see the branch names rather than guess)
git checkout -b origin/MOODLE_23_STABLE MOODLE_23_STABLE
git reset --hard (just in case)
Rex:
Each week after the updates to Moodle (Thursday) I do the following in master branch...
git fetch upstream
This more often than not causes a flurry of activity after which I do the following...
for BRANCH in MOODLE_22_STABLE MOODLE_23_STABLE master; do
git push origin refs/remotes/upstream/$BRANCH:$BRANCH
done
This then downloads all recent changes but does not change your local files...
to see if you can Fast Forward your local branch do the following...
git status
this will tell you how many commits have been merged since your last update and can be fast forwarded...so next you do...
git pull origin
And that's it...basically I just follow the instructions in Git for developers
you then start to fast forward all the other branches...so next I do...
git checkout MOODLE_22_STABLE
git status (to see if I can fast forward)
git pull origin MOODLE_22_STABLE
and then I do the same for MOODLE_23_STABLE
git checkout MOODLE_23_STABLE
git status (to see if I can fast forward)
git pull origin MOODLE_23_STABLE
And that is more or less it...
But whenever a new version arrives, like in the next month or so, as soon there will be MOODLE_24_STABLE as the new kid on the block!
This is when I have to refer to this forum discussion:
http://moodle.org/mod/forum/discuss.php?d=192524
Mary
Mary, that is fine if you are only going to be on the stable branches, but how do I properly jump from one stable branch to another?
In our workflow we start with a stable branch, merge in our feature branches, push that to our master. Then when we need to upgrade to the next version I just merge in the next stable branch, but it results in a ton of conflicts and seeming a couple of errant commits.
Hi Rex,
OK What I do is have all my workflow branches in a seperate part of my computer than the brances that are in the www part of my WAMP server, These are the branches I test my themes on while building them.
When I update using the method that I posted previously, is how I update my Moodle branches which I use for bug fixing on Moodle Tracker. This is master MOODLE_23_STABLE and MOODLE_22_STABLE
When I have updated all of these working branches I then change directory to my TEST sites using ...
cd ../../wamp/www/moodle231
then here I do ...
git pull origin MOODLE_23_STABLE
and then ...
cd ../Moodle224
git pull origin MOODLE_22_STABLE
which is my MOODLE_22_STABLE and MOODLE_23_STABLE branchs from my GITHUB
And that's it. I never add anything to it, never merge anything to it or whatever.
But that said I do have custom themes working in this branch, I just have not added them in GIT nor have I commited theme into Master. but then this isn't a production site, and as far as I am aware, one would not be wanting to add stuff to master that is going to confict with genuine Moodle updates, basically I keep master clean and tidy, then I know where I am.
Yikes, that is very problematic. We do a lot of little core changes/tweaks and have a bunch of blocks/plugins.
How do you go about cherry-picking if your changes can number soon into the 100s? Also, cherry pick from the last time that we merged in a major revision branch?
<EDIT> Can you describe how you upgrade your local changes with core version upgrades?
Here is a discussion where some of Moodle's git wizards give some suggestions: http://moodle.org/mod/forum/discuss.php?d=191774