If you want to see what is done inside the script UpdateMoodle.sh please feel free to open it with a text editor. It is only a text file but it uses the macOS feature to open a file with a chosen program via doubleclick.

We setup the system utility Terminal to open the file UpdateMoodle.sh and to run the contained script automatically. So everything can be done with a doubleclick. It's easy and everybody can do it!!
#! /bin/sh
#
# This GIT installer for macOS is part
# of the installation package Moodle4Mac
#
# 20240420 - Ralf Krause
#
echo
echo "+--------------------------------------------+"
echo "| GIT updater for your local Moodle server"
echo "+--------------------------------------------+"
echo
cd /Applications/MAMP/htdocs
if ! test -e moodle404/.git ; then
## the first git update must get everything including .git
git clone --depth 1 -b MOODLE_404_STABLE https://github.com/moodle/moodle.git moodle404-git
if test -e moodle404-git ; then
if test -e moodle404 ; then
if test -e moodle404/config.php ; then
cp moodle404/config.php moodle404-git/.
fi
DATE=`date +%Y%m%d-%H%M`
mv moodle404 moodle404-$DATE
fi
mv moodle404-git moodle404
fi
## the old folder can be deleted now
## if you want to do this please remove '##' from the following line
## rm -R moodle404-*
else
## the next git update only gets the new files
cd moodle404
git pull
cd ..
fi