How to download code from a particular branch in AzureDevOps release pipeline

6.6k Views Asked by At

I need to download all the files from the feature branch in AzureDevOps release pipeline. I am using Azure repo. Is there any task in AzureDevOps classic editor for the same? How to implement this using Powershell?

1

There are 1 best solutions below

0
Bright Ran-MSFT On

[UPDATE]

In your release pipeline,

  • if a previous step in the same job will check out the source repository but not check out the feature branch, you can use the git checkout command to check out the feature branch to the local repository on the agent machine, and this command also will switch the current branch to feature in the local repository.
git checkout -b feature --track origin/feature
  • if no previous step to check out any source version from the repository, you can use the git clone command to only check out the the feature branch to the local.
git clone <Repo_URL> -b feature

You can use either Bash or PowerShell to execute these commands in your pipeline.