Problem
You already use Visual Studio TFS to host your codes. However, you want to create personal codes or to migrate your TFS into a GIT. This article will discuss how to use GIT on your Visual Studio Code and Visual Studio Online Account.
Requirements
Before we start, please make sure you already have
After that install Visual Studio codes and Git Hub client. Beside of that please create your visual studio host account such as ridilabs.visualstudio.com. after get let's get started
Solution
- You will see you GIT URL. This is your personal URL and you need username and password to access it. You can use visual studio create username and password for you. The username and password (Live id/Office 365 account) is not work on this case, so you need to create a new password and username for each project.
- After that visit your GIT client by executing GIT bash app, please types Git init
- After that please create an empty repository, by using GIT GUI. You create a new folder and then select it as your new repository. Click create to create your new repository.
- Choose remote menu on GIT GUI, choose add, and then insert your GIT URL.
- You will be asked a permission on your visual studio, and then the code will be fetched. Please note you don't have any codes, so you wont get anything right now.
- Let's open our visual studio codes. Please choose open folder, navigate to a folder that we already created for GIT repo
- Let's create a simple text a 'readme' file on the codes and save it. Navigate to Git icon and you will find changes on the file.
- The difference between GIT and TFS is you can do two steps saving, first one we call commit, and the second one we call it push. Commit means save to local repo, and Push means save to remote repo. On TFS you only have one which is commit means push to the cloud (TFS Server).
- On VS Code to commit just choose checklist icon. You will need to type a message to describe your commit activity.
- And of you want to push it into visual studio, just choose more option and then choose push to, you will choose the remote URL on command pallet. You can also choose publish to push the codes into the default branch master
- You can check to your remote repo by visiting the visualstudio.com and then files tab.
- That's it J you already connected your Visual Studio Codes with GIT.