GIT+VSTS CLI Tutorial [beginner level]

Let us learn GIT CLI with basic commands to manage our Source Code in VSTS GIT repos.


  1. Install the GIT bash for Windows from GIT URL.
  2. Quick Launch Desktop Shortcut.
  3. List the profile currently activated for GIT on local machine. 
  4. Change the GIT local credential to another subscription or account.
  5. How to Clone, update, checkin Master branch in VSTS via GIT CLI.

GIT Command Line Usage Tutorial

Install the GIT bash for Windows from GIT URL
Download the latest version

List the profile currently activated for GIT on local machine
The below command is used to check the current profile configured with our local GIT credential manager.

$ git config –global –list

The following and are used to when finally we push our code to the GIT hub. These values are displayed in the portal showing who modified the code base or file.

$ git config –global –list


Change the GIT local credential to another subscription or account

If you want to change the Profile to some other account like corporate account, simply use below highlighted commands as shown.

$ git config –global “”

$ git config –global “”

We can verify the configured profile as well.

$ git config –global –list


Note: When we are about to Push our code finally to GIT HUB branch, there may be a popup to verify our password. This may be one-time activity. Windows is smart enough to store all credential in ‘Credential Manager’.

How to clone a master branch from VSTS GIT repo branch.

Note: develop branch will be acting as a pre-prod branch, once the develop branch code is successfully built with proper team lead approvals then we merge it to master branch to deploy in the production environment.

* develop is for all Pre-production environment deployments (SIT, CI, UAT, Pre-Prod).

* master branch is used for all production environment deployments (Prod).

Step1: Verify that we have a Master branch under our GIT Repository in VSTS account

Click on master branch and go to ‘Clone’ and copy the HTTPS URL link.

Using GIT CLI clone the master to your local machine directory

Step2: Change to working directory on your local machine via GIT CLI

$ cd “C:\Users\admin\Documents\GitTutor”

Step3: Now clone the GIT master branch by using its URL we copied in the previous step.

$ git clone “”

Step4: Change working directory to the cloned GIT folder on local machine

$ cd “C:\Users\admin123\Documents\GitTutor\Automation”

Note: Now the GIT CLI shows the current active branch by displaying the branch name on end like (master).

Step5: Now {Create/Copy} your entire {new/existing} code-solution inside the working directory of GIT on your local machine.

*Display the directory files what we have added just now.

$ dir

Step6: Now add the new file(s) to the local GIT memory and this is added to current active branch that is ‘master’.

$ git add *

*” is used to add all files. We can specify individual files as well with specific file name.

$ git add “AppSettings.json”

Step7: Commit the changes to local GIT with proper comment

$ git commit -m “Checking in basic solution”

New file(s) added to the code/solution, so we need to add this file to local GIT and commit.

*If we don’t run the command for add and commit then the newly added/edited files won’t be pushed to remote repository.

Step8: Push the finally committed master branch to remote repo

$ git push -u origin master

—-Will be updating the remaining content soon—-





Please follow or contact this blog for more updates.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s