1

How do I invoke the commit input message box from the Source Control View (using one command/shortcut)? git.commitall invokes a floating commit message window.

enter image description here

The reason I want the one in the Source Control is that it provides the commit history with arrow keys and also shows you the changes underneath.

starball
  • 20,030
  • 7
  • 43
  • 238
cppbest
  • 59
  • 8
  • so you want that one with the `git.commitall` command? Or you just want whatever keyboard shortcut will focus that one? – starball Jul 29 '23 at 19:20
  • @starball i want the green one with whatever keyboard shortcut, idk which command invokes it, otherwise i'd just use it – cppbest Jul 30 '23 at 08:24
  • I have moved my answer post [here](https://stackoverflow.com/a/76886742/11107541), since I do not want to have the appearance of double-dipping for reputation (unless someone copies my answer from there back to here under CC-BY-SA (in that case I want to take credit)). I will vote to close this question as a duplicate once the bounty period has ended. – starball Aug 11 '23 at 22:58
  • @starball finally! The answer that works! Thank you! – cppbest Aug 12 '23 at 05:01

1 Answers1

-1
  • You can use the short cut key Ctrl + Shift + G G to open the source control from your active VS Code window.

  • You can also find the list of keyboard shortcuts by pressing the Ctrl + K Ctrl + S (File > Preferences > Keyboard Shortcuts) or you can use the VS Code cheat sheet on web for windows.

  • Additionally, you can provide your own key bindings for commands by editing the commands and specifying your own short-cut key.

Update

How to define your own key bindings?

1- Open the Keyboard Shortcuts by pressing Ctrl + K Ctrl + S

2- Search for command workbench.view.scm or Source Control

3- You can define your own key bindings by either clicking on the edit icon (you'll see edit icon when hover over the row) or double clicking on the Keybindings column cell of specific command (in this case, workbench.view.scm).

4- A popup window will appear with title "Press desired key combination and then press ENTER". Here you can press your desired keys from keyboard, e.g. if I press ctrl + shift + M at once, and, then press enter, it will be my new key binding (keyboard short cut) for source control

enter image description here

Ghulam Farid
  • 470
  • 4
  • 10
  • But... I did mention that very same shortcut in my answer. I did not mention the Keyboard Shortcuts, because I did not find any command for that specific view. – VonC Aug 06 '23 at 11:50
  • Actually, when I started writing answer, there's no any answer on this post. Any way you can go to the `File > Preferences > Keyboard Shortcuts` from your main menu for all the keyboard short cuts. – Ghulam Farid Aug 06 '23 at 12:08
  • 2
    Strange, since I posted my answer 50 minutes before yours ;) – VonC Aug 06 '23 at 12:10
  • " I did not mention the Keyboard Shortcuts, because I did not find any command for that specific view.": meaning, there is no command you could find in `File > Preferences > Keyboard Shortcuts` for you to map a shortcut to that "source control" view. – VonC Aug 06 '23 at 12:11
  • So, what command should I keybind?) – cppbest Aug 07 '23 at 04:02
  • @VonC btw, the command for just switching to the Source Control is `workbench.view.scm` – cppbest Aug 07 '23 at 04:06
  • @cppbest, if you'll see at the key bindings that are already set i.e. ( `Ctrl`+`Shift`+`G` `G`) you can define your own key bindings by double clicking the cursor on **Keybindings** column or clicking on edit icon. Let me update my answer. – Ghulam Farid Aug 07 '23 at 04:16
  • I know how to change keybindings, what I don't know is the command that I need to change in this particular case. – cppbest Aug 07 '23 at 04:20
  • You've to change this command `View:Show Source Control(workbench.view.scm)` . You can search by either `workbench.view.scm` or `View:Show Source Control` – Ghulam Farid Aug 07 '23 at 04:45