问题
I'm using the Git Source Control Provider extension for Visual Studio 2010, and I'd like to set a hotkey for Commit, but I can't make it work. I'd like to define a keyboard shortcut for whatever command is run by right-clicking anywhere in my solution, selecting "Git->Commit" (the one with the cow icon, not the one provided by TortoiseGit).
I've set a hotkey for GitPlugin.Connect.GitExtensionsCommit (Ctrl+G, Ctrl+C), to be used globally (yes, I had to disable some other hotkey settings that used Ctrl+G), but whenever I use it I get an error message saying that the command is not currently available.
How do I set hotkeys for the Git Source Control Provider?
回答1:
After playing around with this, I was able to get it working.
I configured Ctrl+\, Ctrl+K to be the shortcut (but you can set your own as long as there are no conflicts).
After that, if you select any project/file node and hit the shortcut, it'll trigger the commit.
The catch here is that you have to select a project
or file
in solution explorer
which makes sense because otherwise, the provider doesn't know what to commit.
来源:https://stackoverflow.com/questions/6676294/git-source-control-provider-hotkeys