Work from the Git command prompt
Visual Studio provides most of the fundamental capabilities to develop an app in a Git version-controlled codebase. You might have to use the command prompt for some manual tasks or to automate work using a script.
If you are not an experienced Git user, use the command prompt carefully. Make sure to research the command thoroughly before you use it.
I want to…
Can I do it in Visual Studio?
How do I do it from the command prompt?
Amend my last commit. Some typical cases:
Apply a tag to a commit
No, but you can view them. See View and manage past versions in Git.
You can use the command prompt to push, edit, and remove tags (see Git-scm: Git Basics - Tagging) from a repository in TFS if you have 39997de5-b7fb-4777-b779-07de0543abe6#Git.
Branch and merge
Yes (but some conflicts can be resolved only at command prompt).
Commit my changes
Copy (clone) a remote repository to my dev machine
Create (initialize) a local repository
Create or edit a note
You can use the command prompt to push, edit, and remove notes (see Git-scm: Note to Self) from a repository in TFS if you have 39997de5-b7fb-4777-b779-07de0543abe6#Git.
Get information about my local repository (such as the remotes I am tracking)
If the repository is in a TFS team project, then yes. Otherwise, no.
Preview (fetch) and then download (pull) changes from a remote repository
Yes (but some conflicts can be resolved only at the command prompt)
Push changes to a remote repository
Re-order history or combine (squash) commits.
Revert a committed change by applying the inverse of the commit. See rolling back changes with revert.
Undo committed changes by returning my local repo to a prior commit and de-referencing the later commit.
View and manage my changes since the last commit
Before you can use the command prompt tools, you have to install them and then enable basic authentication.
If you have not already installed some command prompt tools, you can get some quickly from Visual Studio. (One way you can tell that you don’t have the tools is if you try to enter a git command and get the 'git' is not recognized as an internal or external command... message.)
If your repository is hosted on Visual Studio Online, you must enable basic authentication before you can use the command prompt to perform Git tasks. You can set this up from your User Profile in TFS.
You can launch the Git command prompt from the Actions menu on the Changes (Keyboard: Ctrl + 0, G), Commits, and Branches pages.
You can also launch the Git command prompt from repositories on the Connect (Keyboard: Ctrl + 0, C) page.