Commit Fast, Ship Faster
git
vscode
keybinding
If you prefer not to type a commit message every time, you can set a default message for all commits. You can do this by changing the settings in VS Code. Here's how to make these changes:
- Edit the Task in
.vscode/tasks.json
:- Open your project in VS Code.
- Open the
.vscode
folder in your project root (create it if it doesn't exist). - Create or edit the
tasks.json
file within the.vscode
folder. - Replace the content of
tasks.json
with the following:{ "version": "2.0.0", "tasks": [ { "label": "git add, commit, and push", "type": "shell", "command": "git add -A && git commit -m 'Auto-commit' && git push", "problemMatcher": [], "group": { "kind": "build", "isDefault": true }, "presentation": { "reveal": "never", "panel": "dedicated", "clear": true } } ] }
- Create a Custom Keybinding:
- Open the Command Palette in VS Code (
CMD + Shift + P
). - Type
Preferences: Open Keyboard Shortcuts (JSON)
and select it. - In the
keybindings.json
file that opens, add the following entry:{ "key": "cmd+shift+enter", "command": "workbench.action.tasks.runTask", "args": "git add, commit, and push" }
- Open the Command Palette in VS Code (
- Using the Shortcut:
With your project open in VS Code, pressCMD + SHIFT + ENTER
. This will execute thegit add
,commit
(with the message "Auto-commit"), andpush
commands in sequence.
This setup will allow you to push your changes with the specified keybinding without needing to input a commit message each time. Remember, using a generic commit message like this might not be the best practice for tracking changes effectively in a collaborative project.