Edit on GitHub


Group of utility functions to get lists of Git revisions in a DVC repository.

def all_branches(repo: Optional[str] = None) -> List[str]:
def all_commits(repo: Optional[str] = None) -> List[str]:
def all_tags(repo: Optional[str] = None) -> List[str]:


import dvc.api

branches = dvc.api.scm.all_branches()
commits = dvc.api.scm.all_commits()
tags = dvc.api.scm.all_tags()


Get a list of all Git branches/commits/tags in a DVC repository.

Returns the names for branches and tags and the SHAs for commits.


  • repo - specifies the location of the DVC project. It can be a URL or a file system path. Both HTTP and SSH protocols are supported for online Git repos (e.g. [user@]server:project.git). Default: The current project (found by walking up from the current working directory tree).

Example: Passing results to dvc.api.exp_show()

The results of the dvc.api.scm functions can be passed to the revs argument of dvc.api.exp_show():

import dvc.api
import pandas as pd

all_tags = dvc.api.scm.all_tags()
exps = dvc.api.exp_show(revs=all_tags)

๐Ÿ› Found an issue? Let us know! Or fix it:

Edit on GitHub

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

Discord Chat