First Step:
git remote add upstream https://github.com/moodle/moodle.git
Second Step:
vim update.sh
#!/bin/bash
git fetch upstream
for BRANCH in MOODLE_{31..37}_STABLE master;
do
git push origin refs/remotes/upstream/$BRANCH:refs/heads/$BRANCH
done