lesson
Manually staging files, writing commit messages, committing, and syncing to Git involves multiple repetitive steps. This lesson demonstrates how to significantly streamline this common Git workflow in Cursor (or VS Code) by creating a single, powerful keyboard shortcut using `keybindings.json` and the `runCommands` feature.
**Workflow demonstrated in this lesson:**
* Open `keybindings.json` to customize keyboard shortcuts.
* Unbind default shortcuts (like `Shift+Cmd+S`) that you might not use.
* Utilize the `runCommands` command to create a sequence of actions.
* Chain together `git.stageAll`, `cursor.generateGitCommitMessage`, `git.commitAll`, and `git.sync` commands.
* Bind this entire sequence to a single custom keyboard shortcut.
* Execute the full stage -> AI commit message -> commit -> sync workflow with one keystroke.
**Key benefits:**
* Combines multiple Git actions into one efficient step.
* Automates staging, committing, and syncing changes.
* Leverages Cursor's AI to generate commit messages automatically.
* Frees up valuable keyboard shortcuts for powerful custom workflows.
* Significantly speeds up your development cycle by reducing manual Git operations.
```json
{
"key": "shift+cmd+s",
"command": "runCommands",
"args": {
"commands": [
{
"command": "git.stageAll"
},
{
"command": "cursor.generateGitCommitMessage"
},
{
"command": "git.commitAll"
},
{
"command": "git.sync"
}
]
}
},
{
"key": "shift+cmd+s",
"command": "-workbench.action.files.saveAs"
},
{
"key": "shift+cmd+s",
"command": "-workbench.action.files.saveLocalFile",
"when": "remoteFileDialogVisible"
}
```