Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit/update default Get Sources step in build task TFS?

We've got an issue where the Get Sources step on our builds is taking very large time to clone the repository on Agent for the first time however second time taking less time.

So is there a way to optimize Get Sources step so that it should not clone the whole history instead the last commit history.

Below is the example what we need to do in Get Sources step:

1. Master Branch
git clone --depth 1 <Repo Url>

2. Feature Branch
cd <Project Name> 
git remote set-branches origin %remote_branch_name%
git fetch --depth 1 origin %remote_branch_name%
git checkout %remote_branch_name%
like image 286
Naveen Kumar Avatar asked Oct 26 '25 18:10

Naveen Kumar


1 Answers

You can configure the --depth 1 also in Azure DevOps.

If you use .yaml pipeline:

steps:
- checkout: self
  fetchDepth: 1

In the classic editor (in the "Get Sources" option):

enter image description here

Then you can add a command line task that do the cd and the other commands.

like image 174
Shayki Abramczyk Avatar answered Oct 29 '25 08:10

Shayki Abramczyk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!