Making code changes in DevOps using Visual Studio

To download Visual Studio: \Tc4s0a\groups\AARA\AARAD\Software Library\Developer Tools\Microsoft

To make changes to the code, follow these steps:

Clone the repository

  1. Open Azure DevOps.

  2. Select Repos and choose the repository using the dropdown menu in the top bar.

  3. Click Clone.

  4. Copy the link that is shown.

  5. Open Visual Studio and select “Clone a repository”.

  6. Paste the link copied in step 4, into the “Repository location” field.

  7. Click Clone.

Create feature branch

If you have already made all your code changes locally while on the dev branch but have not yet committed anything, you can still follow the steps below to create your feature branch. You may need to stash your changes before you do the pull, and when unstashing, you may need to resolve merge conflicts.

  1. Make sure you are on the dev branch and then do a pull (to ensure you have the latest code).

  2. Click on the branch dropdown then click New Branch.

  3. Name the branch as follows: feature/PbiNumber-PbiTitle. To be safe, ensure that the new branch is based off of origin/dev (i.e. the remote dev branch, to ensure you have all the latest changes that are in dev).

  4. The bottom-right corner should now show the name of your branch. If not, switch to your feature branch.

  1. Open Azure DevOps.

  2. Go to Repos > Branches > New Branch.

  3. Add a name, select your work item and click Create.

    • Branch naming convention: feature/PbiNumber-PbiTitle

Make your code changes (then commit & push)

  1. You can now make all your changes for the PBI/Bug.

  2. To view the changes you have made since your last commit, open the “Git Changes” window or click on the pencil icon in the bottom menu bar.

  3. To ensure that changes are not lost if your computer breaks down or if you have to take sudden leave, please make sure to commit and push your changes to the remote server at the end of each day (even if changes are unfinished).

    • You can check what changes were made to each file by double-clicking on the files in the list.

    • If there is a * beside the file name, this indicates that it has not been saved & the change will not be committed. Sometimes there are no changes and you just need to double-click on the file for it to disappear from the list.

    • If you only wish to commit some of the files, you can stage them by right-clicking on the file and selecting “Stage”.

    • Select “Commit All and Push” in order to commit your changes locally then push to DevOps.

  4. Once all your changes have been pushed to the remote server, there should be a 0 beside both icons in the bottom bar.

Create a pull request

Once you have finished making all your changes and have pushed them all to the remote feature branch in DevOps, you must now create a pull request to merge the changes into the dev branch.

  1. Open Azure DevOps.

  2. Select Repos, then Pull requests.

  3. Make sure you have the correct repo selected (in top bar).

  4. Click on the “New pull request” button.

  5. Select the source branch (aka the feature branch where you made all your changes). Make sure it is feature into dev.

  6. Add/Edit the title of the pull request. This will be what shows up in the history of the dev branch so make sure that it describes the changes made.

  7. Add a description if needed.

  8. Link the PBI you were working on.

  9. You can review the changes using the File tab.

  10. Once you are done, click on Create. The pull request will now be created and it will check for any merge conflicts. If there are any, you will need to resolve them before the pull request can be completed.

  11. Copy the link for the pull request and send it in the team chat for someone to review.

  12. Once someone on your team has approved the PR, you can now click on the Complete button.

  13. Make sure only the 2nd checkbox is checked off. This deletes the feature branch once the merge is complete so that we don’t have any long-living branches once the changes are already in the dev branch.

  14. Click Complete and the changes will now be merged into the dev branch.