Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code stage changes shortcut

What is the VS Code stage changes shortcut?

I mean is it possible to stage a selected file without clicking the plus button in the version control tab?

enter image description here

Maybe there is no shortcut an it is somehow possible to setup one?

like image 589
qqqqqqq Avatar asked Dec 30 '19 22:12

qqqqqqq


3 Answers

My custom workflow:

  1. Open the SCM view ctrl+shift+G
  2. Select the file in SCM using up/down arrow keys
  3. Diff the file spacebar
  4. Stage the file ctrl+up
  5. Diff the file spacebar
  6. Stage the file ctrl+up

How to configure?

Preferences: Open Keyboard shortcuts (JSON) command: workbench.action.openGlobalKeybindingsFile
Then put in the following:

    {
        "key": "ctrl+up",
        "command": "git.stage",
        "when": "workbench.scm.active"
    }
like image 114
Paulius Zaliaduonis Avatar answered Oct 23 '22 12:10

Paulius Zaliaduonis


git.Stage and git.StageAll. They have no keybinding assigned by default. You can assign a custom one in your keyboard shortcut settings. CMDK+CMDS

like image 30
hotpink Avatar answered Oct 23 '22 12:10

hotpink


for those who interested in stageAll / unstageAll, you can also do these as well

[
    {
        "key": "ctrl+up",
        "command": "git.stageAll",
    },
    {
        "key": "ctrl+down",
        "command": "git.unstageAll",
    }
]
  1. CTRL/CMD+SHIFT+P
  2. Open Keyboard Shortcuts (JSON)
  3. Place your key bindings
like image 27
HoseinGhanbari Avatar answered Oct 23 '22 12:10

HoseinGhanbari