André Lynum
06/09/2026, 11:37 AMMarvin
06/09/2026, 11:37 AMMarvin
06/09/2026, 11:39 AMpython
from prefect import flow
from prefect.runner.storage import GitRepository
@flow
def my_flow():
pass
if __name__ == "__main__":
my_flow.from_source(
source=GitRepository(
url="<https://github.com/my-org/my-repo.git>",
branch="v1.2.3", # tag name
),
entrypoint="flows.py:my_flow",
).deploy(
name="prod",
work_pool_name="my-pool",
)
Or in `prefect.yaml`:
yaml
pull:
- prefect.deployments.steps.git_clone:
repository: <https://github.com/my-org/my-repo.git>
branch: v1.2.3
A few notes:
- Prefect uses the branch field for both branches and tags
- You cannot set both branch and commit_sha at the same time
- If omitted, Prefect defaults to main
Relevant docs:
- Store flow code
- Deploy via Python
If you want, I can also show the exact syntax for doing this with prefect deploy from a prefect.yaml.