# Branching direct model deployments [Direct model deployments](../create-a-model-deployment/index.md) integrate with [Global Branching](../../global-branching/overview/index.md), allowing you to change and test a deployment configuration and its model function on a branch before merging the changes into `main`. For general information about branches, proposals, and rebasing, see [Global Branching core concepts](../../global-branching/core-concepts/index.md). ## Build and modify a deployment configuration Before you begin, create a direct model deployment for the model on `main`. To configure a direct model deployment on a global branch: 1. Create or open a global branch and build a model version on that branch. 2. After the build completes, open the model on the same global branch and select the **Live deployment** tab. Foundry automatically creates a disabled branch deployment by copying the configuration from `main` and adds the deployment configuration to the global branch. 3. Edit and save the deployment configuration. 4. To test the branch deployment, select **Start deployment**. Changes to the deployment configuration are isolated to the global branch. The configuration on `main` and other branches is unchanged until the proposal is merged. To remove the deployment configuration from a global branch, open the [modified resource panel](../../global-branching/branch-taskbar/index.md#modified-resource-panel) in the branch taskbar, open the resource menu, and select **Remove from branch**. This removes the deployment configuration from the branch proposal. ## Publish and use a model function on a branch You can publish or update a [model function](../../functions/functions-on-models/index.md) from a direct model deployment on a global branch. Foundry publishes a branch-local function version with a version suffix in the format `-branch-YYYYMMDD-HHMMSS`. To view this version, open the [model](../../model-integration/models/index.md) and select **Live deployment**, then **Overview**. The version appears in the **Function** section. You can use the function version in supported applications on the same global branch, but it is not available from `main` or other branches. Foundry only supports branch-local model function versions on global branches. A model branch that is not associated with a global branch cannot publish a branch-local function version. For more information about branched function versions, see [Branching functions](../../functions/branching-functions/index.md#direct-model-deployment-functions). ## Protect the deployment configuration You can [protect the deployment configuration](../../global-branching/resource-protection-and-approval-policies/index.md) by requiring changes on `main` to be made through a global branch and proposal. When the deployment configuration is protected, build the model on a global branch, make the deployment changes on that branch, and create a proposal to update `main`. ## Review and approve changes After you create a proposal, the approval banner in the **Live deployment** tab shows the approval status and required reviewers. Reviewers can open a side-by-side comparison of the deployment configuration on `main` and the global branch, then approve or reject the changes. The comparison includes runtime configuration and model function settings. ![Reviewing differences between live deployment configurations on the main branch and a global branch.](../../../assets/08c64b38de573170c0b56d4c115e482d355bc85a6d97b205b83bde9d3a7fcd4e.webp) The following checks must succeed before you can merge the proposal: * Required approvals are satisfied. * The deployment configuration is up to date with `main`. * The model has been built on the global branch. * If a model function is published, its target stable version has not already been published on `main`. ## Rebase the deployment configuration If the deployment configuration on `main` changes after you create or rebase the global branch, the **Live deployment** tab prompts you to rebase. To rebase the deployment configuration: 1. Select **Start rebase**. 2. Review the side-by-side comparison of the configurations on `main` and the global branch. 3. Select **Use Main branch changes** or **Keep current branch changes**. 4. Select **Finish rebase**. ![Choosing which live deployment configuration to keep while rebasing.](../../../assets/e1342a4384304652262c0cddd7af32e009da101116c60adc5e93d6f785e27fa8.webp) Rebasing keeps one complete configuration; you cannot resolve individual fields separately. If you use changes from `main` that modify deployment sources while the branch deployment is running, select **Restart and rebase** to restart the deployment with the updated sources. You must also rebase if the target stable version for a branch-local model function has already been published on `main`. ## Merge changes into the `main` branch Merging the proposal applies the selected deployment configuration to `main`. If the model does not already have a direct deployment on `main`, Foundry creates one in a disabled state. Start the deployment when you are ready to use it. If the global branch includes a model function, merging publishes the selected branch-local function configuration as a stable function version on `main`.