Hands-on demo – Working with Git locally and Azure DevOps integration using Visual Studio Code


LearnAzureDevOps-O5

Hands-on demo – Working with Git locally and Azure DevOps integration using Visual Studio Code

In this demo, we will walk through the process of setting up a local Git repository, committing code changes locally, and pushing those changes to a remote repository on Azure DevOps.

1. Installing Git

Before starting, ensure Git is installed on your machine.

If Git is not installed, download and install it from Git's official website.

2. Setting Up Development Environment with Visual Studio Code

  1. Install Visual Studio Code (VS Code):

    • Download and install Visual Studio Code from here.

  2. Install Git Extension in VS Code:

    • Open VS Code.

    • Navigate to the Extensions view (Ctrl+Shift+X).

    • Search for "Git" and install following two Git extensions.

      • Git Lens and Git History

3. Creating a New Git Repository Locally

  1. Navigate to the Project Directory:

  2. Initialize a New Git Repository:

    This initializes a new Git repository in the current directory.

4. Committing Code Changes Locally

  1. Make Changes to files (e.g., add a new README.md file or modify existing code).

  2. Check the status of changes:

  3. Add files to staging:

  4. Commit changes:

5. Pushing Changes to Remote Repository on Azure DevOps

  1. Create a New Repository on Azure DevOps:

    • Navigate to Azure DevOps.

    • Create a new project and repository.

  2. Link Local Repository to Remote Repository: In Visual Studio Code:

    • Open the Command Palette (Ctrl+Shift+P).

    • Type and select Git: Clone Repository.

    • Enter the URL of your Azure DevOps repository.

  3. Push Changes to Remote Repository:

    This pushes the local commits to the Azure DevOps repository.

6. Verifying Changes on Azure DevOps

Navigate to the Azure DevOps repository to view the pushed changes.

Summary

This process sets up a basic workflow for managing code changes locally and pushing them to a remote repository on Azure DevOps using Visual Studio Code.

Related Articles


Rajnish, MCT

Leave a Reply

Your email address will not be published. Required fields are marked *


SUBSCRIBE

My newsletter for exclusive content and offers. Type email and hit Enter.

No spam ever. Unsubscribe anytime.
Read the Privacy Policy.