Try this
git pull origin {{ $FORGE_VAR_BRANCH }}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am wondering if it's possible to create dynamic staging enviroments with Laravel Forge. I want to be able to issue a command on a Github Pull Request and trigger a deploy on forge using the head branch of the PR. Something like azure static web apps, but for backend applications.
I'm already done with the Github Actions part and was able to pass the branch name via forge deployment trigger URL.
This is my current deployment script, but it seems that I'm unable to checkout and pull to a branch different to the one configured on Forge settings.
cd ...
git fetch
git checkout $FORGE_VAR_BRANCH
git pull origin $FORGE_VAR_BRANCH
$FORGE_COMPOSER install --no-dev --no-interaction --prefer-dist --optimize-autoloader
( flock -w 10 9 || exit 1
echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock
if [ -f artisan ]; then
$FORGE_PHP artisan migrate --force
fi
Any ideas if this is even possible currently on forge?
Please or to participate in this conversation.