Category: Git sync
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How to Change Default Branch for an Appsmith App?

Issue

I want to change the default branch for my Appsmith apps.

Resolution

Let's address the two scenarios where users might want to change their default branch:

Scenario 1 ✅

Multiple apps are connected to a single repository, and the user wants to have different default branches for different apps. This is supported in Appsmith Enterprise Edition, you can follow the below steps to achieve this -
 

  1. Open the desired git connected app in Appsmith.
  2. Click on the ⚙️ option in the bottom bar beside Git action buttons.
  3. Find the "Default Branch" section and click on the dropdown menu.
  4. Select the preferred branch that you want to set as the default.
  5. After selecting the new default branch, click on "Update" button to apply the changes.
  6. The default branch for your app in Appsmith will now be updated to the branch you selected.
Default branch option in Git settings - Appsmith

Scenario 2 ✅

A single app is connected to a repository, and the user wants to change the default branch for that app. The following are the steps to achieve this -

Step 1 -

Go to git-sync, and check if the new default branch exists in the remote repository: `origin/temp`

Current Default Branch

Step 2 -

Go to the remote repository and go to the `settings > general settings` section

Default Branch in Repo
Settings Tab
General Settings

Step 3 -

Find the Default Branch section and click on the `switch to different branch` button to select and update the new default branch. Lastly, click on `I understand ...` for it to take an affect.

Default branch section
Switch default branch
I understand

Step 4 -

Go back to your Appsmith app and click on `sync branches` to synch the default branch change from the repository.

Sync branches

 

Tada 🎉

Now when you enter the edit mode, by default the `temp` branch will be selected.

Default Branch Test