<@ULVA73B9P> how do i use `flow.from_source` but p...
# ask-marvin
k
@Marvin how do i use
flow.from_source
but pull from a different branch other than master?
m
You can retrieve a flow from a specific branch using the
flow.from_source
function by providing additional configuration in the
source
parameter to specify the branch. Here's a step-by-step guide: 1. Import the
flow
module from
prefect
. 2. Use
flow.from_source
, and specify the git repository URL. 3. For a different branch, append
#branch_name
to the end of the repository URL. 4. Define the
entrypoint
, pointing to the file and function name where the flow is defined.
Copy code
python
from prefect import flow

my_flow = flow.from_source(
    source="<https://github.com/org/repo.git#branch_name>",
    entrypoint="flows.py:my_flow"
)

if __name__ == "__main__":
    my_flow()
Replace
branch_name
with the name of the branch from which you want to pull the flow.