The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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).

git-branch, git-merge

Commit my changes




You can associate a work item with a commit by including the ID in your comment. For example, you apply this comment #35 Catch null exception to your commit. When you push this commit into TFS, the commit will be associated with work item #35.

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)

git-fetch, git-pull

Push changes to a remote repository


Git-scm: git-push

Re-order history or combine (squash) commits.


Git-scm: Git Branching - Rebasing, Git-scm: Squashing Commits, git-rebase

Revert a committed change by applying the inverse of the commit. See rolling back changes with revert.


git-revert(1) Manual Page

Stash changes


Git-scm: Git Tools - Stashing

Undo committed changes by returning my local repo to a prior commit and de-referencing the later commit.


According to Undoing Things, ...this is a dangerous command: Any changes you made to that file are gone — you just copied another file over it. Don’t ever use this command unless you absolutely know that you don’t want the file.



View and manage my changes since the last commit


Git-scm: Git Basics - Recording Changes to the Repository, Git-scm: Git Basics - Undoing Things

View history


Git-scm: Git Basics - Viewing the Commit History

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.)

Installing the Git command prompt tools
  • The install process drops a Git Bash icon on your desktop. We recommend you delete this icon because we don’t believe this entry point leads to the best experience. If for some reason you want to run Git Bash later, you can do so from Windows Start.

  • To make using the command prompt less tedious (for example, to avoid having to enter your credentials every time you push), you might want to also install Windows Credential Store for Git.

  • If you want to run Git commands from PowerShell, install Posh-Git (a PowerShell environment for Git).

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.

Enabling basic authentication

You can launch the Git command prompt from the Actions menu on the Changes (Keyboard: Ctrl + 0, G), Commits, and Branches pages.

Opening the command prompt

You can also launch the Git command prompt from repositories on the Connect (Keyboard: Ctrl + 0, C) page.

Open the command prompt from a repository