To change your Moodle version using Git, you primarily use the
git checkout command to switch between version-specific branches. This process is the standard way to "upgrade" your site’s codebase. [1, 2, 3, 4]1. Preparation and Backup
2. Fetch the Latest Code [1]
Navigate to your Moodle root directory in the terminal and ensure your local Git repository knows about all available branches from the official source.
bash
git fetch --all
Use code with caution.
3. Identify the Target Branch
bash
git branch -a
Use code with caution.
4. Switch to the New Version [1]
Example: Switching to Moodle 4.5
bash
git checkout -b MOODLE_45_STABLE origin/MOODLE_45_STABLE
Use code with caution.
If the branch already exists locally, simply use:
git checkout MOODLE_45_STABLE.5. Finalize the Upgrade
- Via Web Interface: Log in to your site as an administrator and go to Site administration > Notifications. Moodle will detect the version change and guide you through the database update.
- Via CLI (Recommended): Run the upgrade script directly from your terminal to avoid web server timeouts.[1, 2, 3, 4, 5]bash
php admin/cli/upgrade.phpUse code with caution.
Important Tips
- Maintenance Mode: It is highly recommended to put your site into Maintenance Mode before starting.
- Check Plugins: Ensure any third-party plugins you use are compatible with the new Moodle version.
- Permissions: After running Git commands, verify that your web server still has the correct ownership and permissions for the Moodle directory.
- Reference: For more detailed instructions, see the official Git for Administrators documentation on MoodleDocs. [1, 2, 3]
0 Comments