Manage Code In GIT With Azure DevOps

Introduction

 
This is the second part of my Azure DevOps series. Kindly make sure you have gone through the previous article, for a better understanding of the concept.
 
Step-1 Create a new repository
 
Once the project is created, open the project, click Repos --> Create New Repository. Add a README file to describe your repository and .gitignore. Please refer to my previous article to know about the importance of README file and .gitignore. Once you are done with this, click "Create".
 
Manage Code In GIT With Azure Devops
 
Manage Code In GIT With Azure Devops
 
You will find the README file in your project repository once you created your new repository, as shown below in the screenshot.
 
Manage Code In GIT With Azure Devops
 
Step-2 Open Visual Studio
 
Open Visual Studio to manage the Git repository. In Team Explorer, you will find a dropdown link as "Manage Connections".Click "Connect to a Project".
 
Manage Code In GIT With Azure Devops
 
Choose the new repository you created in Azure DevOps. In the dropdown, you will find the path. The repository that you created in Azure DevOps is going to clone with this path. Just copy the path and click "Clone".
 
Manage Code In GIT With Azure Devops
 
Once cloning is done, you can see in the output that the remote repository is cloned to the local machine, as given below in the screenshot.
 
Manage Code In GIT With Azure Devops
 
Step-3 Manage files in local machine
 
After cloning, open the path you copied. You can find the README file in your local machine.
 
Manage Code In GIT With Azure Devops
 
Copy and paste the file to the local repository. Here, the dotnetlayout.md file is copied to my local repository. 
 
Manage Code In GIT With Azure Devops
 
Step-4 Commit the file
 
Go to homepage and click "Changes". You will find one change that depends on how many files you added to your local repository. Only one file is added in this project, so you will see that file in changes. Add a message and click "Commit all".
 
Manage Code In GIT With Azure Devops
 
Once it is done, you will see a commit created locally.
 
Manage Code In GIT With Azure Devops
 
Step-4 Push the file
 
Go to the homepage and click "Sync". You will find two options - Pull and Push. Click the Push command.
 
Manage Code In GIT With Azure Devops
 
Once it is done, you will be successfully pushed to origin/master as given below.
 
Manage Code In GIT With Azure Devops
 
Step-5 Verify changes on Azure DevOps console
 
Once the sync is done, go back to Azure DevOps refresh/reload, you can see the file deployed from local repository to git repository. In this way, you can manage your git repository with Visual Studio.
 
Manage Code In GIT With Azure Devops
 
Repeat the same procedure and add all files from a local repository to the Git repository. Here, an age calculator project is deployed from the local repository to Git repository.
 
Manage Code In GIT With Azure Devops
 

Summary

 
I hope this article is interesting. Follow the steps and manage the code in Git with Azure DevOps. In case it is a Java project, how can you  deploy the file from the local repository to Git repository? Stay tuned for the next article to deploy java files from a local repository to a Git repository with Azure DevOps.
 
Thanks for reading!!!