I use this script, which comes with no guarantee:
#!/usr/bin/env bash
cd /home/pi/MagicMirror
echo "######### CHECKING MAGIC MIRROR ##########"
git fetch
if [ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]
then
echo "######### UPGRADING MAGIC MIRROR #########"
git pull
npm install
else
echo "######## NO UPGRADE REQUIRED #########"
fi
echo ""
cd modules
for directory in *; do
if [[ -d ${directory} && ${directory} != "node_modules" && ${directory} != "default" ]]; then
echo "######### CHECKING ${directory} ##########"
cd ${directory}
git fetch
if [ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]; then
echo "######### UPGRADING ${directory} #########"
git pull
if [[ -e "package.json" && -f "package.json" ]]; then
npm install
fi
else
echo "######## NO UPGRADE REQUIRED #########"
fi
echo ""
cd ..
fi
done