Automating Git Workflow in VS Code: AI Commit & Sync with One Shortcut

Published: (January 1, 2026 at 03:39 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Prerequisites

  • GitHub Copilot – for AI‑generated commit messages.
  • Multi‑command (by ryuta46) – to chain VS Code commands.

Step 1: Define the command sequence

Chain the necessary commands and add a delay so Copilot has time to generate the message.

  1. Open VS Code Settings (JSON): Ctrl+Shift+PPreferences: Open User Settings (JSON).
  2. Add the following to your settings:
{
  "multiCommand.commands": [
    {
      "command": "multiCommand.aiCommitFlow",
      "sequence": [
        "git.stageAll",
        "github.copilot.git.generateCommitMessage",
        {
          "command": "extension.multiCommand.execute",
          "args": { "interval": 5000 }
        },
        "git.commitStaged"
      ]
    }
  ]
}

Note: interval: 5000 (5 seconds) is a safety buffer for the AI. Reduce it to 3000 if Copilot responds faster.

Step 2: Map the keyboard shortcut

Bind the sequence to a single hotkey.

  1. Open Keyboard Shortcuts (JSON): Ctrl+Shift+PPreferences: Open Keyboard Shortcuts (JSON).
  2. Add this binding:
{
  "key": "ctrl+alt+g",
  "command": "multiCommand.aiCommitFlow",
  "when": "config.git.enabled"
}

To run the flow without interruption, disable the confirmation dialogs:

  • Git: Confirm No Stage Confirmation – uncheck to skip “Do you want to stage all files?”
  • Git: Confirm Sync – uncheck to skip the push confirmation.

You can find these settings via Ctrl+, and searching for “Git: Confirm”.

How it works

Press Ctrl + Alt + G and VS Code will:

  1. Stage all current changes.
  2. Invoke GitHub Copilot to generate a commit message based on the diff.
  3. Wait for the configured interval (default 5 seconds) to ensure the message is populated.
  4. Commit the staged changes.

This transforms a multi‑step manual process into a single, seamless action.

Back to Blog

Related posts

Read more »

I made Codedraft proactive!

Overview CodeDraft is now active and observant. Instead of waiting for you to remember to capture learnings, it works in the background to suggest them at the...