All of the actions that can be performed in Visual Studio's Team Explorer (TE) are also git commands that can be run the command line. Sometimes the command line can provide additional details that may be helpful when managing local and remote repositories.

Changes


Git Commands - Changes
The following git commands can be run from the command line and return the same information:
- Find modified files
- git ls-files -m
- Find new/added files
- git ls-files --others --exclude-standard

Branches

Use this area to create a new branch for your code and to revert/undo any changes. You can also use this area to checkout a branch:

To see what current branch you are on, look in the lower, right corner of Visual Studio:

Git Commands - Branches
To see what branch you are on from the command line, use the "git branch" command:

To checkout a branch from the command line, use the "git checkout <branch>" command:

To create a new branch and immediately checkout that branch, use "git checkout -b <branch>":

Git Commands - Reset
In TE you can revert your changes and delete any added files. To revert any modified files to what you last pulled from the server, use the 'git reset' command (the --hard switch is optional and will not warn you about having local files that have been modified):

The above command will reset you to the latest commit, if you want to reset to a specific commit, get the commit number and use it with git like this: git reset --hard cdaed2d2

Sync

The Sync command will synchronize your branches on your local machine with the master repository. When you create a new branch locally, the master repository is not aware that local branch exists. Using the "Fetch" command in the "Synchronization" window will pull down any branches that your local environment is not aware of. Using the "Push" command will create the new branch in the master repository.
Git Commands - Sync/Fetch
Git doesn't have a command called 'sync' but does this through two commands: fetch and push.
If you would like to pull down all branches from the server, use the 'git fetch' command. The result will be a list of the branches that your local repository did not know about:

With a newly created local branch, use the 'git push <branch>' to have this branch created on the server

Git - Reset your code to the last time you pulled
git reset –hard