

When you're done exploring and want to go back to your branch, you can choose to discard your changes by checking out an existing branch or choose to keep your changes by creating a new branch first.Configure the author name and email address to be used with the commits.
#GIT LIST BRANCHES COMMAND CODE#
Now that you are in a detached head state, feel free to run and test your code or even explore and commit changes. Meaning that the HEAD of your repository is going to point directly to a commit instead of a branch. Visual Studio shows a confirmation dialog explaining that by checking out a commit, you'll be in a detached HEAD state. To check out a previous commit in Visual Studio, open the Git Repository window, right-click the commit you would like to go back to and select checkout (–detach).

In this case, you can just check out the tip of the remote branch that you would like to review. That way you don’t need to create a local branch if you aren't planning on contributing to it. It can also be helpful if you would like to review code from a remote branch (a colleague’s branch, for example). For example, it allows you to go back to a previous point in your repository’s history where you can run or test your code. If you prefer an inline diff, you can use the Diff Configuration Options gear icon and switch to an inline diff view.Ĭhecking out a commit can be beneficial in multiple ways. When you find a commit that you want to focus on, select the Open in New Tab button to open the commit on a different tab. You can browse through any local or remote branch without having to switch your branch. The Alt+ Up arrow or Alt+ Down arrow keyboard shortcuts allow you to jump between these sections. For example, the previous screenshot shows the changes that one commit introduced to the Files.csproj file. You can check the changes that a commit has introduced by selecting them, which shows a difference.


#GIT LIST BRANCHES COMMAND FOR MAC#
Applies to: Visual Studio Visual Studio for Mac Visual Studio Code
