Upgrade Moodle using Git with installed plugins

Re: Upgrade Moodle using Git with installed plugins

by Ken Task -
Number of replies: 1
Picture of Particularly helpful Moodlers

Wow!   This response delayed due to circumstances beyond control.   Hope you've resolved the problem already.   But, if not ... here goes ...

Qualifications for this response: not a git guru but can google.

Git doesn't normally 'loose track' but it would recognize if a file has changed.    Did you maually edit or tinker with the webservices files listed?   Hope not as they are core.

The other listing of files look to be mostly addons/plugins.   How were those installed?

Have run the git stash before as suggested via git before.    Seem to fix and never had issue with that site again.    Still made me wonder though.    Not long ago discovered yet another 'glitch' ... a git branch -a kept listing two versions at the top and neither had the asterisc marking that one as the one being tracked.   There was something network related that prevented git from acquiring what it needed.  Git would get to 80% and then stop!!!! ?????   Never did figure that out.   Share with network folks what we were seeing (they had a rather restrictive VPN setup ... no one could sneeze!).    Think network forks relaxed a rule or something cause the next git started to behave as expected.

Via google, found a command to 'reset' git.

First, re-issue the two commands for the branch desired ... need to match what's in version.php of the site -the # symbol below needs to be changed to a digit.

git branch --track MOODLE_3#_STABLE origin/MOODLE_3#_STABLE
git checkout MOODLE_3#_STABLE

That makes sure you've told git which version.    They might report 'already tracking' or 'not needed' ... that's a good sign.

Then issue:

git reset --hard

Check the branch ... before pulling the trigger on upgrade.php.    Is is the one desired?

git branch -a

update and upgrade went well after that.   And as far as I know, the site is still running ok.

'spirit of sharing', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Upgrade Moodle using Git with installed plugins

by Christos Savva -

Hi Ken

Always with detailed explanations!! Thank you!

Being on version 3.3 I wanted to update to 3.3.2.

I did search on Google and I used

git stash

Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD commit.(source)

Then

git pull

Everything worked, my plugins are still there, Moodle core files were updated and update worked like a charm. Site is fully functional.

To answer your question, the additional plugins where installed without git.

Now the only question pending in my mind is if git stash will work when I want to go from branch 3.3 to 3.4. I have the feeling that your solution (git reset) will be suitable then.

Kind regards

Christos