Edit on GitHub

exp branch

Commit the results from an experiment in a new Git branch.


usage: dvc exp branch [-h] [-q | -v] experiment [branch]

positional arguments:
  experiment     Experiment to turn into a branch
  branch         Optional name for the new Git branch. Defaults to '{experiment-name}-branch'


Creates a new Git branch containing the target experiment from the experiment's baseline (HEAD at the time the experiment was run).

This turns the experiment into one or more regular commits (one per checkpoint in the case of checkpoint experiments).

If you don't provide a branch name, the default one will be based on the name of the experiment.

Note that DVC does not switch into the new branch automatically.

dvc exp branch is useful to make an experiment persistent without modifying the workspace so they can be continued, stored and shared in a normal Git + DVC workflow.

To switch to the new branch, use git checkout branch and dvc checkout. Or use git merge branch and dvc repro to combine it with your current project version.


  • -h, --help - shows the help message and exit.

  • -q, --quiet - do not write anything to standard output. Exit with 0 if no problems arise, otherwise 1.

  • -v, --verbose - displays detailed tracing information from executing the dvc pull command.

Example: Make a persistent branch from an experiment

This example is based on our Get Started, where you can find the actual source code.

Let's say we have run 3 experiments in our project:

$ dvc exp show
  neutral:**Experiment**               neutral:**Created**           metric: **auc**   param:**featurize.max_features**   param:**featurize.ngrams**
  workspace                -              0.61314   1500                     2
  10-bigrams-experiment    Jun 20, 2020   0.61314   1500                     2
  ├── major-mela           Oct 21, 2020   0.61314   1500                     2
  ├── gluey-leak           Oct 09, 2020   0.57756   2000                     2
  └── ochre-dook           Oct 09, 2020   0.51676   500                      2

We can create a branch from gluey-leak:

$ dvc exp branch gluey-leak
Git branch 'gluey-leak-branch' has been created from experiment 'gluey-leak'.
To switch to the new branch run:
        git checkout exp-gluey-leak

And inspect the result with Git:

$ git branch
* master

gluey-leak-branch can now be checked out, merged, rebased, pushed, etc. like any other Git branch.


🐛 Found an issue? Let us know! Or fix it:

Edit on GitHub

Have a question? Join our chat, we will help you:

Discord Chat