Skip to main content

Description

Promote an experiment to a permanent Git branch. This command creates a Git branch from an experiment, making it part of your regular Git history. This is useful when you want to preserve a successful experiment as a permanent branch for collaboration, code review, or deployment.
Use this command to convert temporary experiments into permanent branches that can be pushed to remote repositories and shared with your team.

Usage

Arguments

string
required
The experiment name to promote to a branch.Can be:
  • Auto-generated experiment name (e.g., exp-a1b2c)
  • Custom experiment name (specified with -n during dvc exp run)
string
Name for the new Git branch. If not specified, defaults to {experiment-name}-branch.

Examples

Create branch with auto-generated name

Output:
The default branch name is the experiment name with -branch appended.

Create branch with custom name

Output:
Use descriptive branch names following your team’s Git conventions (e.g., feature/, experiment/, model/).

Push branch to remote

Output:

Create branch and switch to it

Output:
The new branch contains the full experiment state including code, parameters, and DVC pipeline information.

List and promote workflow

Output:

Common Workflows

Collaboration Workflow

Production Release Workflow

Multi-stage Promotion

Feature Branch Workflow

Understanding Branch Creation

When you create a branch from an experiment:

What Gets Included

  1. Git Commit: A proper Git commit is created containing:
    • Code changes from the experiment
    • Parameter files (params.yaml)
    • DVC pipeline files (dvc.yaml, dvc.lock)
    • Metrics files
  2. Commit Message: Auto-generated message includes:
    • Experiment name
    • Timestamp
    • Changed metrics and parameters
  3. DVC Cache: References to cached model outputs and data
The branch is a full Git branch, indistinguishable from branches created manually. It can be merged, rebased, and pushed like any other branch.

Branch vs Apply

Choose between dvc exp branch and dvc exp apply:

Integration with Git

View branch history

Output:

Merge to main branch

Delete branch after merge

Deleting the Git branch doesn’t delete the experiment. The experiment remains accessible via dvc exp show until explicitly removed with dvc exp remove.

Troubleshooting

Branch already exists

Output:
Solution:

Experiment not found

Output:
Solution:
  • dvc exp show - View available experiments to promote
  • dvc exp apply - Apply experiment to workspace without creating branch
  • dvc exp run - Create new experiments
  • dvc exp remove - Remove experiments (doesn’t affect created branches)
  • git branch - Standard Git branch operations