Visual studio code 在VisualStudio代码中,是否有一种方法可以在一个命令中保存所有文件、提交和上载
我发现自己在代码上做了很多修补程序,我必须在远程机器上进行测试。在VisualStudio代码中,是否有方法设置将Visual studio code 在VisualStudio代码中,是否有一种方法可以在一个命令中保存所有文件、提交和上载,visual-studio-code,vscode-settings,vscode-tasks,Visual Studio Code,Vscode Settings,Vscode Tasks,我发现自己在代码上做了很多修补程序,我必须在远程机器上进行测试。在VisualStudio代码中,是否有方法设置将 保存所有打开的文件 提交更改(使用空白或随机提交消息) 上载所有提交 谢谢 我想你可以安排一个任务来为你做这项工作 如果这还不够,让我知道,我可以给你写一个例子。 任务中最好的事情是,您可以将它们绑定到热键。要做到这一点,您需要一次运行多个命令,所以您需要一个扩展。使用此配置,Ctrl+Alt+S将保存并推送所有文件 settings.json(Ctrl+,): 我添加了一个命令,
谢谢 我想你可以安排一个任务来为你做这项工作 如果这还不够,让我知道,我可以给你写一个例子。
任务中最好的事情是,您可以将它们绑定到热键。要做到这一点,您需要一次运行多个命令,所以您需要一个扩展。使用此配置,
Ctrl+Alt+S
将保存并推送所有文件
settings.json(Ctrl+,
):
我添加了一个命令,在命令运行后切换终端,这样它就不会在每次运行命令时都保持打开状态。不幸的是,即使终端已经打开,也会发生这种情况,因此如果您不希望它这样做,只需删除该行即可
keybindings.json(Ctrl+K
Ctrl+S
):
tasks.json:
{
"tasks": [
{
"label": "syncAll",
"type": "shell",
"command": "git add .;git commit -m 'Automatic Commit';git pull;git push",
}
]
}
不保存文件:
keybindings.json
:
{
"key": "ctrl+alt+s",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "git add . && git commit -a -m 'Update' && git push\u000D"
}
}
"multiCommand.commands": [
{
"command": "multiCommand.syncAllFiles",
"sequence": [
"workbench.action.files.saveAll",
{
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "git add . && git commit -a -m 'Update' && git push\u000D"
}
}
]
}
]
{
"key": "ctrl+alt+s",
"command": "extension.multiCommand.execute",
"args": { "command": "multiCommand.syncAllFiles" },
}
关于sendSequence
:
保存文件时:
超过调整的TOM
:
(使用)
settings.json
:
{
"key": "ctrl+alt+s",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "git add . && git commit -a -m 'Update' && git push\u000D"
}
}
"multiCommand.commands": [
{
"command": "multiCommand.syncAllFiles",
"sequence": [
"workbench.action.files.saveAll",
{
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "git add . && git commit -a -m 'Update' && git push\u000D"
}
}
]
}
]
{
"key": "ctrl+alt+s",
"command": "extension.multiCommand.execute",
"args": { "command": "multiCommand.syncAllFiles" },
}
keybindings.json
:
{
"key": "ctrl+alt+s",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "git add . && git commit -a -m 'Update' && git push\u000D"
}
}
"multiCommand.commands": [
{
"command": "multiCommand.syncAllFiles",
"sequence": [
"workbench.action.files.saveAll",
{
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "git add . && git commit -a -m 'Update' && git push\u000D"
}
}
]
}
]
{
"key": "ctrl+alt+s",
"command": "extension.multiCommand.execute",
"args": { "command": "multiCommand.syncAllFiles" },
}
无需执行
任务
谢谢!这太完美了。我所做的唯一修改是:不做git拉动;git push
,我只是做了我需要的git pull origin master。