0

I have a Pull Request on an azure devops remote git repository in format like this https://project-domain/project-name/_git/repo-name/pullrequest/xxxxx

Is there an easy way to just download the files which are part of this pull request without having to clone the entire repository? If i have to use commit ids which are part of this pull request, that's alright with me. please let me know if anyone has done this before

torek
  • 448,244
  • 59
  • 642
  • 775
Sam
  • 1
  • 1
  • Does this answer your question? [How to shallow clone a specific commit with depth 1?](https://stackoverflow.com/questions/31278902/how-to-shallow-clone-a-specific-commit-with-depth-1) – danielorn Aug 20 '21 at 11:50

1 Answers1

0

In Azure DevOps, when viewing a Pull Request, on the Files tab, next to each file is a menu with three dots (...) with an option for "Download". You can do that for any file you wish to download.

However, it's very important to realize that the file you are downloading is the file from the point of view of the source branch. If the source branch is not up to date with the target branch, then you might not be downloading the final version of that file that will exist at the time the PR is completed. If you wish to download the future version of the file after PR is completed, then you should select the three dots (...) button next to the Complete button, and select "View Merge Commit". From there you can download each of the files the same way as previously described, and now you'll get the version of the files that would exist if you completed the PR right now. Obviously if that file gets modified on the target branch between now and when the PR is actually completed, the file would change yet again.

Side note, if you have many files in the PR that you wish to download, as far as I know you cannot download them all together in one shot from the UI, though you can probably automate it using the API (or by cloning and doing a diff which you said you wanted to avoid).

TTT
  • 22,611
  • 8
  • 63
  • 69