What do you mean by change a Github branch? Switch to a new/different branch and pull that?
Change a github branch for a site already setup with Forge
The only way I've been able to change the branch used for deployment in Forge is to remove the repository and add it again. Would be helpful if there was an easier way to do it.
@bashy - yes. I would like Forge to pull from a new/different branch.
Not sure if it uses current branch via the directory but, SSH in and switch branch then update?
You can do this now, in the site settings just scroll down a bit:

Hope this helps someone!
@djave_co That caught me, it doesn't actually do anything. Unless this feature is newer than my sites.
Forge provisions the sites using a single branch shallow commit
git clone --depth 50 --single-branch -b staging [email protected]:adampatterson/repo repo
@djave_co Anyone else landing here, as of 2025 - it's there. Midway down the Deployments page.
@sheriffderek yes!
If you need to change branches on a staging or test server you'll need to adjust the .git/config file.
When Forge provisions a site it's cloned by using a single branch shallow clone using --single-branch which will prevent you from checking out another branch.
git clone --depth 50 --single-branch -b staging [email protected]:adampatterson/repo repo
git branch -r
origin/staging
This locks the repo to the staging branch.
[remote "origin"]
url = [email protected]:adampatterson/repo
fetch = +refs/heads/staging:refs/remotes/origin/staging
Run git config remote.origin.fetch refs/heads/*:refs/remotes/origin/* to allow multiple branches.
Then run git fetch to update the local branches.
[remote "origin"]
url = [email protected]:adampatterson/maker
fetch = refs/heads/*:refs/remotes/origin/*
git branch -r
origin/dev
origin/main
origin/staging
git fetch origin then git switch main
Locking the repo git config remote.origin.fetch refs/heads/main:refs/remotes/origin/main
@adampatterson Thx this exactly what I needed for my staging server
@cosminbosutar Awesome!
I was getting really frustrated when I'd change the branch in Forge and then it was stuck. It was only when I looked at the provision script did I notice how it was checked out.
@adampatterson You lovely person! Thank you for this!
This saved my life. Thank you very much.
that' exactly the solution I needed, thanks.
i wish the branch selector in the interface would do something like this...
git config --add remote.origin.fetch +refs/heads/BRANCH_NAME:refs/remotes/origin/BRANCH_NAME
git fetch origin BRANCH_NAME
git checkout -b BRANCH_NAME origin/BRANCH_NAME
^ that seems to work though, if anyone is interested
Please or to participate in this conversation.