【问题标题】:i want to modify Redgate source control Git.xml file to include commit and push我想修改 Redgate 源代码控制 Git.xml 文件以包含提交和推送
【发布时间】:2012-12-14 06:28:02
【问题描述】:

以下是 redgates 源代码管理中 git.xml 文件的摘录

<element>
<key type="string">Commit</key>
<value version="1" type="GenericHookCommand">
<CommandLine>git commit -F "($MessageFile)" -o "($ScriptsFolder)\"</CommandLine>
<Verify>exitCode == 0</Verify>
</value>
</element>

我希望修改它以包含推送,因此当您在管理工作室中进行提交时,它也会推送到 git。

我尝试添加另一个命令,例如

<CommandLine>git commit -F "($MessageFile)" -o "($ScriptsFolder)\"</CommandLine>
<commandline>git push</commandline> 

也试过了

 <CommandLine>git commit -F "($MessageFile)" -o "($ScriptsFolder)\" && git push</CommandLine>

但两者都不起作用,关于如何获得提交和推送工作的任何想法

【问题讨论】:

    标签: redgate


    【解决方案1】:

    问题在于裸与号。将行更改为:

    <CommandLine>git commit -F "($MessageFile)" -o "($ScriptsFolder)\" &amp;&amp; git push</CommandLine>
    

    您也可以将其包装在 CDATA 中,但上述方法似乎对我有用。

    注意:如果推送或拉取需要您输入密码,则 Red Gate 插件将停止并强制您终止 SSMS。因此,在更新 XML 之前,请确保您可以先通过命令行 git pull 和 git push。

    【讨论】:

      【解决方案2】:

      您使用 SQL 源代码控制获得的命令文件实际上只是为了同步您的本地存储库而设计的,而不是执行推/拉操作。

      我认为您建议的任何一种方法都行不通 - 对于第一个,我认为该工具甚至不知道运行第二个命令,对于第二个选项,我不相信您可以连接以这种方式的命令。

      我唯一的建议(AFAIK 从未尝试过)是编写您自己的 dos 批处理文件(或 powershell,如果那是您的东西),它采用相同的参数,然后运行您想要的两个命令。

      然后您可以为 SQL 源代码控制创建一个新的配置文件来执行您的批处理/powershell,而不是直接执行 git。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-06-02
        • 2013-05-02
        • 2014-11-29
        • 2014-10-11
        • 2016-12-26
        • 2018-10-03
        • 2021-01-29
        相关资源
        最近更新 更多