{"id":241192,"date":"2023-01-23T08:00:45","date_gmt":"2023-01-23T16:00:45","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=241192"},"modified":"2023-01-24T13:38:16","modified_gmt":"2023-01-24T21:38:16","slug":"keyboard-shortcuts-to-master-your-git-flow-in-visual-studio","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/keyboard-shortcuts-to-master-your-git-flow-in-visual-studio\/","title":{"rendered":"Keyboard Shortcuts to Master Your Git Flow in Visual Studio"},"content":{"rendered":"<p>One popular way for users to optimize their efficiency is to leverage shortcuts to interact with the UI. With Git tasks, like Committing, Pulling, and Pushing being part of your daily workflow, learning how to avoid leaving the keyboard for the mouse can keep you in the zone.<\/p>\n<table style=\"width: 98.4383%; height: 347px;\">\n<tbody>\n<tr>\n<td style=\"text-align: left; width: 96.2912%;\" colspan=\"2\" width=\"623\"><strong>Git Shortcuts<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; width: 49.8626%;\" width=\"312\">Open Git Changes and shift focus to the Commit Message box<\/td>\n<td style=\"text-align: left; width: 46.4286%;\" width=\"312\">Alt+G, C<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; width: 49.8626%;\" width=\"312\">Open the Git Repository Window<\/td>\n<td style=\"text-align: left; width: 46.4286%;\" width=\"312\">Alt+G, M<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; width: 49.8626%;\" width=\"312\">Open the Branch Picker from the status bar<\/td>\n<td style=\"text-align: left; width: 46.4286%;\" width=\"312\">Ctrl+Alt+F3<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; width: 49.8626%;\" width=\"312\">Open the Repository Picker from the status bar<\/td>\n<td style=\"text-align: left; width: 46.4286%;\" width=\"312\">Ctrl+Alt+F4<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; width: 49.8626%;\" width=\"312\">Open the network operations context menu from the status bar<\/td>\n<td style=\"text-align: left; width: 46.4286%;\" width=\"312\">Ctrl+E, Ctrl+C<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Checkout some other shortcuts on this <a href=\"https:\/\/visualstudio.microsoft.com\/keyboard-shortcuts.pdf\">printable keyboard shortcut cheatsheet for Visual Studio available for download<\/a>.<\/p>\n<p>Try out the following Git keyboard workflows to see which shortcuts you can work into your daily practice. Not only can they help you be more productive and iterate quicker, but they can be easier to access for folks who don\u2019t want to or are unable to move the mouse.<\/p>\n<h3><\/h3>\n<h3>Create a New Branch with the Status Bar<\/h3>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Branch-Picker-Shortcut.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-241193\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Branch-Picker-Shortcut-300x96.png\" alt=\"Image Branch Picker Shortcut\" width=\"300\" height=\"96\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Branch-Picker-Shortcut-300x96.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Branch-Picker-Shortcut.png 501w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Often, the first action of a new bug fix or some feature work is to create a new branch. To complete this action without using the mouse:<\/p>\n<ul>\n<li>Use <strong><u>Ctrl+Alt+F3<\/u><\/strong> to open the Branch Picker from the status bar.<\/li>\n<li>Use <strong><u>Tab<\/u><\/strong>, then\u00a0<span style=\"text-decoration: underline;\"><strong>Enter<\/strong><\/span>\u00a0to select the option for New Branch.<\/li>\n<li>Type in the name of your new branch, then use the <strong><u>Tab key<\/u> <\/strong>to cycle between the rest of the items (<strong><u>Shift+Tab<\/u><\/strong> cycles in the reverse direction, once the first item is in focus \u2013 meaning there\u2019s a slim, dotted border around it, you can navigate using the <strong><u>Up and Down Arrow Keys<\/u><\/strong>).\n<ul>\n<li>For the dropdown menu tap <strong><u>Enter<\/u><\/strong> to open it, and navigate using the <strong><u>Up and Down Arrow Keys<\/u><\/strong>, using <strong><u>Enter<\/u><\/strong> to make your selection or <strong><u>Esc<\/u><\/strong> to exit the dropdown menu.<\/li>\n<li>For the checkbox tap the <strong><u>Space<\/u><\/strong> to toggle it.<\/li>\n<\/ul>\n<\/li>\n<li>Use <strong><u>r<\/u><\/strong> or arrow\/tab to Create and tap <strong><u>Enter<\/u><\/strong> to complete the action.<\/li>\n<\/ul>\n<h3><\/h3>\n<h3>Commit Your Changes Faster<\/h3>\n<p>Once you update your code use <strong><u>Ctrl+S<\/u><\/strong> to save your work, then commit your changes without using the mouse:<\/p>\n<ul>\n<li>Use <strong><u>Alt+G, C<\/u><\/strong> to focus the commit message text box in the Git Changes Window via the Top Level Menu.<\/li>\n<li>Type your commit message, tapping <span style=\"text-decoration: underline;\"><strong>Ctrl+Enter<\/strong><\/span> to commit all staged files or all changes if nothing is staged.\n<ul>\n<li>If you\u2019d like to review your changes before committing, see the alternative flow below<\/li>\n<\/ul>\n<\/li>\n<li><strong><u>Shift+Tab<\/u><\/strong> to back cycle to the Push icon and tap <strong><u>Enter<\/u><\/strong> to Push your changes.<\/li>\n<\/ul>\n<p><strong>Alternate Flow \u2013 Use the Diff View to quickly preview your changes<\/strong><\/p>\n<ul>\n<li><strong><u>Tab<\/u><\/strong> to the document group you\u2019d like review, use the <strong><u>arrow keys<\/u><\/strong> to focus the document, and tap <strong><u>Enter<\/u><\/strong> to open it in the Diff View.<\/li>\n<li>Use <strong><u>Ctrl+F8<\/u><\/strong> to view the next difference and <strong><u>Ctrl+Shift+F8<\/u><\/strong> to view the previous difference.<\/li>\n<li>Learn how to set your own keyboard shortcuts in the One Step Further with Customization section below, to perform actions like staging your files.<\/li>\n<\/ul>\n<h3><\/h3>\n<h3>Quickly Navigate to View your Repo Status<\/h3>\n<p>Whenever you want to checkout manage your branches, use shortcut <strong><u>Alt+G, M<\/u><\/strong> to navigate quickly to the Git Repository Window. Again, using <strong><u>Tab<\/u><\/strong> and the <strong><u>Up and Down Arrows<\/u><\/strong>. Additionally, <strong><u>Alt+UP\/DOWN<\/u><\/strong> arrows will allow you to navigate between sections, including the:<\/p>\n<ul>\n<li>Branches (the left side selector)<\/li>\n<li>History (the right side list)<\/li>\n<li>Commit Details (actions for the commit, commit message)<\/li>\n<li>Commit Diff<\/li>\n<\/ul>\n<p>Learn more at <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/version-control\/git-browse-repository?view=vs-2022#browse-through-local-and-remote-branches\">Browse repos, compare branches &amp; commits <\/a>on Microsoft Learn.<\/p>\n<h3><\/h3>\n<h3>Switch Active Repositories<\/h3>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Repo-Picker-Shortcut.png\"><img decoding=\"async\" class=\"alignnone wp-image-241195\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Repo-Picker-Shortcut-300x40.png\" alt=\"Image Repo Picker Shortcut\" width=\"420\" height=\"56\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Repo-Picker-Shortcut-300x40.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Repo-Picker-Shortcut-1024x136.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Repo-Picker-Shortcut-768x102.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Repo-Picker-Shortcut.png 1131w\" sizes=\"(max-width: 420px) 100vw, 420px\" \/><\/a><\/p>\n<p>Back in the status bar, you can also use the shortcut <strong><u>Ctrl+Alt+F4<\/u><\/strong> to open the Repository Picker which allows you to quickly switch active repositories, bringing up the Git Repository Window for review.<\/p>\n<h3><\/h3>\n<h3>One Step Further with Customization<\/h3>\n<p>Take the next step towards keyboard mastery by assigning your own Keyboard menu of the Options dialog. Get there by typing \u201cKeyboard\u201d into the search bar. For example, you can stage files using the keyboard, by assigning shortcuts to these commands:<\/p>\n<ul>\n<li>Git.Remove &#8211; Works as a toggle. If a staged file is focused, it will be unstaged. If an unstaged file is focused, it will be staged. The name is not super friendly, so we introduced the next two.<\/li>\n<li>Git.Stage &#8211; Stages an unstaged file. Doesn&#8217;t work in reverse.<\/li>\n<li>Git.Unstage &#8211; Unstages a staged file. Doesn&#8217;t work in reverse.<\/li>\n<\/ul>\n<p>To see all of the commands for git, type &#8220;Git&#8221; into the \u201cShow commands containing:\u201d search.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Git-Commands-Keyboard-Shortcuts.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-241194\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Git-Commands-Keyboard-Shortcuts-300x250.png\" alt=\"Image Git Commands Keyboard Shortcuts\" width=\"300\" height=\"250\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Git-Commands-Keyboard-Shortcuts-300x250.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Git-Commands-Keyboard-Shortcuts-768x640.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Git-Commands-Keyboard-Shortcuts.png 861w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>To learn more about how to customize key bindings checkout <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/ide\/identifying-and-customizing-keyboard-shortcuts-in-visual-studio?view=vs-2022\">Identify and customize keyboard shortcuts<\/a>.<\/p>\n<h3><\/h3>\n<h3>Beyond Git Shortcuts<\/h3>\n<p>There\u2019s a lot of content on Microsoft Learn to help you continue to make the most of the keyboard. You can start by checking out the most popular <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/ide\/default-keyboard-shortcuts-in-visual-studio?view=vs-2022\">keyboard shortcuts for Visual Studio<\/a> and dive deeper, including <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/ide\/reference\/accessibility-tips-and-tricks?view=vs-2022#access-toolbars-by-using-keyboard-shortcuts\">accessibility tips and tricks<\/a> and learning how to <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/ide\/reference\/how-to-use-the-keyboard-exclusively?view=vs-2022\">use Visual Studio without a mouse<\/a>. Find other productivity tips in the <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/ide\/productivity-features?view=vs-2022\">Productivity guide<\/a>.<\/p>\n<h3><\/h3>\n<h3>Thank You<\/h3>\n<p>Thanks for checking out ways to boost your productivity with Git keyboard shortcuts. Hopefully, these flows demonstrate how to make incorporating Git into your daily coding sessions easy and unobtrusive. If you have any feedback, use <a href=\"https:\/\/microsoft.sharepoint.com\/teams\/dd_vsblog\/Blog%20Post%20Drafts\/aka.ms\/devcomm\">Developer Community<\/a> to report an issue or <a href=\"https:\/\/aka.ms\/vs-suggest\">Suggest a Feature for Visual Studio<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One popular way for users to optimize their efficiency is to leverage shortcuts to interact with the UI. With Git tasks, like Committing, Pulling, and Pushing being part of your daily workflow, learning how to avoid leaving the keyboard for the mouse can keep you in the zone. Git Shortcuts Open Git Changes and shift [&hellip;]<\/p>\n","protected":false},"author":98326,"featured_media":241196,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[6839,431,6758,6882],"class_list":["post-241192","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-developer-productivity","tag-git","tag-git-integration","tag-keyboard-shortcuts"],"acf":[],"blog_post_summary":"<p>One popular way for users to optimize their efficiency is to leverage shortcuts to interact with the UI. With Git tasks, like Committing, Pulling, and Pushing being part of your daily workflow, learning how to avoid leaving the keyboard for the mouse can keep you in the zone. Git Shortcuts Open Git Changes and shift [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/241192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/98326"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=241192"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/241192\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/241196"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=241192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=241192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=241192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}