Posts

Showing posts with the label Azure Devops

Azure DevOps - Compare Two Commits Right In The Web UI?

Image
Answer : If you go to the list of branches for a repository, you can click on ... (More Actions) on one of the branches and choose Compare branches This will take you to a URL in the form: https://dev.azure.com/{organisation}/{project}/_git/{repository}/branches?baseVersion=GB{baseBranch}&targetVersion=GB{targetBranch}&_a=files You can then change the baseVersion and targetVersion parameters in the query string. These can take the following forms, and can be mixed and matched: GB{branchName} GC{commitHash} GT{tagName} Just in case that link gets broken, clicking "View Merge Changes" on a pull request takes you to the same page but with a slightly different URL https://dev.azure.com/{organisation}/{project}/_git/{repository}/branchCompare?baseVersion=GC{baseCommit}&targetVersion=GC{targetCommit}&_a=files I'm not sure if there's a nicer way of comparing commits from the UI, as it only shows branches and tags, but if you do it this wa...

Checkout Part Of A Branch In Azure DevOps Pipelines (GetSources)

Answer : In Azure DevOps you don't have option to get only part of the repository, but there is a workaround: Disable the "Get sources" step and get only the source you want by manually executing the according git commands in a script. To disable the default "Get Sources" just specify none in the checkout statement: - checkout: none In the pipeline add a CMD/PowerShell task to get the sources manually with one of the following 2 options: 1. Get only part of the repo with git sparse-checkout. For example, get only the directories src_1 and src_2 within the test folder (lines starting with REM ### are just the usual batch comments): - script: | REM ### this will create a 'root' directory for your repo and cd into it mkdir myRepo cd myRepo REM ### initialize Git in the current directory git init REM ### set Git sparsecheckout to TRUE git config core.sparsecheckout true REM ### write the directories that y...

Change GIT Account Of Visual Studio Team Explorer

Image
Answer : Look in the Windows Credential manager and remove/update your credentials there: In my case just removing credentials from Windows Credential didn't fix it. I first removed all git and azure related accounts from Windows Credential, then removed accounts from VS>Files>Account Settings, and then VS asked me new credentials and connected to the project. But my commits were still made with the old account! Finally I found out that it was the git config: C:\Users\[USER NAME]\.gitconfig I deleted the whole user section in that file which looks like this: [user] name = [OLD ACCOUNT NAME] email = [OLD ACCOUNT EMAIL] On next commit VS asked me git account information and done. If you want to work with different accounts for different projects on same machine, read this. I am using VS 2017 and this is how I updated my Password for TFS, using Git repository. From the Menu: Team -> manage Connection Click on Manage Connection Link -> Connect ...

Azure Pipeline To Trigger Pipeline Using YAML

Image
Answer : For trigger of one pipeline from another azure official docs suggest this below solution. i.e. use pipeline triggers resources: pipelines: - pipeline: RELEASE_PIPELINE // any arbitrary name source: PIPELINE_NAME. // name of the pipeline shown on azure UI portal trigger: branches: include: - dummy_branch // name of branch on which pipeline need to trigger But actually what happens, is that it triggers two pipelines. Take an example, let suppose we have two pipelines A and B and we want to trigger B when A finishes. So in this scenario B runs 2 times, once when you do a commit (parallel with A) and second after A finishes. To avoid this two times pipeline run problem follow the below solution trigger: none // add this trigger value to none resources: pipelines: - pipeline: RELEASE_PIPELINE // any arbitrary name source: PIPELINE_NAME. // name of the pipeline shown on azure UI portal trigger: branches: includ...