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.
xxxxxxxxxx11git --versionIf Git is not installed, download and install it from Git's official website.
2. Setting Up Development Environment with Visual Studio Code
Install Visual Studio Code (VS Code):
Download and install Visual Studio Code from here.
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
Navigate to the Project Directory:
xxxxxxxxxx11cd path/to/your/projectInitialize a New Git Repository:
xxxxxxxxxx11git initThis initializes a new Git repository in the current directory.
4. Committing Code Changes Locally
Make Changes to files (e.g., add a new
README.mdfile or modify existing code).Check the status of changes:
xxxxxxxxxx11git statusAdd files to staging:
xxxxxxxxxx11git add README.mdCommit changes:
xxxxxxxxxx11git commit -m "Added README file with project description"
5. Pushing Changes to Remote Repository on Azure DevOps
Create a New Repository on Azure DevOps:
Navigate to Azure DevOps.
Create a new project and repository.
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.
Push Changes to Remote Repository:
xxxxxxxxxx21git remote add origin https://dev.azure.com/<yourorganization>/<yourproject>/_git/<yourrepository>2git push origin mainThis 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.






















Leave a Reply