Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 在VisualStudio代码中,是否有一种方法可以在一个命令中保存所有文件、提交和上载_Visual Studio Code_Vscode Settings_Vscode Tasks - Fatal编程技术网

Visual studio code 在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+,): 我添加了一个命令,

我发现自己在代码上做了很多修补程序,我必须在远程机器上进行测试。在VisualStudio代码中,是否有方法设置将

  • 保存所有打开的文件
  • 提交更改(使用空白或随机提交消息)
  • 上载所有提交

  • 谢谢

    我想你可以安排一个任务来为你做这项工作

    如果这还不够,让我知道,我可以给你写一个例子。
    任务中最好的事情是,您可以将它们绑定到热键。要做到这一点,您需要一次运行多个命令,所以您需要一个扩展。使用此配置,
    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。