VS Code Git and Source Control Keyboard Shortcuts

Manage Git operations directly from VS Code using keyboard shortcuts for staging, committing, diffing, and branch management without the terminal.

VS Code

Detailed Explanation

VS Code Git Shortcuts

VS Code has built-in Git integration that lets you perform most source control operations without opening a terminal. These shortcuts streamline the Git workflow.

Opening Source Control

  • Open Source Control (⌃+Shift+G / Ctrl+Shift+G) — jump directly to the Source Control panel showing changed files
  • Toggle Sidebar (⌘+B / Ctrl+B) — show or hide the sidebar where Source Control lives

Inline Diff

VS Code shows inline diff gutters in the editor. Click the gutter to see changes inline:

  • Go to Next Change (⌥+F5 / Alt+F5) — jump to the next modified section in the file
  • Go to Previous Change (⌥+Shift+F5 / Alt+Shift+F5) — jump to the previous change

Stage and Commit

While there is no default single-key shortcut for staging, the Source Control panel supports keyboard-driven workflow:

  1. Open Source Control (⌃+Shift+G)
  2. Navigate to files with arrow keys
  3. Press Enter to open the diff
  4. Use the Command Palette for Git: Stage Changes, Git: Commit, etc.

Git via Command Palette

The Command Palette (⌘+Shift+P / Ctrl+Shift+P) exposes many Git commands:

  • Git: Checkout to... — switch branches
  • Git: Pull / Git: Push — sync with remote
  • Git: Create Branch — create a new branch
  • Git: Stash / Git: Pop Stash — temporarily save changes
  • Git: View File History — (with GitLens extension) see full commit history

Merge Conflicts

When you encounter merge conflicts, VS Code shows inline buttons:

  • Accept Current Change / Accept Incoming Change / Accept Both — click or use Command Palette
  • Compare Changes — opens a side-by-side diff view

Recommended Extensions

  • GitLens — adds blame annotations, history, and comparison features
  • Git Graph — visualize branch history as a graph

Use Case

Using Git shortcuts in VS Code eliminates context-switching to a separate terminal for routine operations. Developers who work primarily in VS Code can stage files, review diffs, create branches, and resolve merge conflicts all within the editor, keeping their focus on the code being changed.

Try It — Keyboard Shortcut Reference

Open full tool