I am using Azure Devops Repos. I have one branch: "master", with this history:
* 🔵 HEAD - Commit 7: Fix production bug (sha: 1a2b3c4)
|
* Commit 6: Add health checks (sha: a1b2c3d)
|
* Commit 5: Improve performance (sha: b2c3d4e)
|
* 🟡 Commit 4 (selected): Refactor auth logic (sha: abc1234)
|
* Commit 3: Add login API (sha: c3d4e5f)
|
* Commit 2: Set up CI pipeline (sha: d4e5f6g)
|
* Commit 1: Init project (sha: e5f6g7h)
I would like to do a visual comparison (in the Azure UI) between "🟡 Commit 4" and "🔵 HEAD - Commit 7". A view which will show me summary of all files which were changed, and the specific changes. Something like we have when we click a specific commit, or when we visualise changes of pull request:
Is there a way to do it in Azure Devops? I know I can compare branches and I can see changes for a single commit, but I would like to see differences for more commits gathered together, similiar like I can do it in IntelliJ just by selecting more than one commit.
Based on this extension's source code, it seems it is possible through a custom URL, e.g.
https://dev.azure.com/yourdevopsorg/_git/yourrepo/branchCompare?baseVersion=GCsourcecommithash&targetVersion=GCtargetcommithash&_a=files
Replace:
Note that the version refs need to be prefixed with either "GB" for "Git branch", or "GC" for "Git Commit", and GC must contain the full 40 character hash. So in your case, if you are comparing commit 4 (abc1234
) with master
, the syntax would be:
https://dev.azure.com/yourdevopsorg/_git/yourrepo/branchCompare?baseVersion=GCabc1234xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&targetVersion=GBmaster
Also note that this uses a 3-dot diff instead of 2-dot, so it only works in 1 direction. If you get no results try swapping the order of your refs.
The extension I linked looks like it'll add buttons to do this for you. Why this isn't a feature out of the box, your guess is as good as mine :D