diff --git a/make_page.sh b/make_page.sh
index 7e103555283f38afffcb67eb26abb62e3e6a42f3..59bf4d358edae7912fe2bac4a03e5ce0618cb3a4 100755
--- a/make_page.sh
+++ b/make_page.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -l
 
 set -e
 
@@ -23,7 +23,7 @@ rsync -auv compiled/* ../
 
 [ ! -d "swift" ] && git clone "git@gitlab.cosma.dur.ac.uk:swift/swiftsim.git" "swift"
 cd swift
-git checkout master
+[ "$(git rev-parse --abbrev-ref HEAD)" != "master" ] && git checkout master
 git pull
 # Generate read the docs
 cd doc/RTD
@@ -42,7 +42,7 @@ cp swift/doc/onboardingGuide/build/latex/onboarding.pdf ../onboarding.pdf
 # Generate read the docs for the zoom branch
 [ ! -d "swift_will" ] && git clone "git@gitlab.cosma.dur.ac.uk:swift/swiftsim.git" "swift_will"
 cd swift_will
-git checkout zoom_docs
+[ "$(git rev-parse --abbrev-ref HEAD)" != "zoom_docs" ] && git checkout zoom_docs
 git pull
 cd doc/RTD
 [ -d "build" ] && rm -rf build