【问题标题】:Open a new git-bash terminal and run commands in it打开一个新的 git-bash 终端并在其中运行命令
【发布时间】:2020-04-21 11:44:13
【问题描述】:

我设置了一个预提交挂钩来在 git 中运行单元测试。这意味着每次我运行 git commit 命令时,它都会自动运行 pytest。

但是,这会使我的 git-bash 终端停止一段时间。 我想要一个命令来打开一个新的 git-bash 窗口并在其中自动运行 git commit -m $mycomment。

我知道我可以通过输入 git-bash 来运行一个新的 git-bash(因为 git-bash.exe 在我的路径中),但是如何在它之后运行一个 'git commit $mycomment'? 谢谢

【问题讨论】:

    标签: bash git git-bash


    【解决方案1】:

    您可以将命令放在 bash shell 脚本中。我们称之为:。

    chmod +x <script name>
    git-bash -c <script name>
    

    我会在脚本中添加一个 sleep 命令,以便您查看任何结果。

    【讨论】:

    • 是的,我考虑过这个选项,但想知道是否还有其他东西,因为这个“git-bash”命令可能也会在脚本中,我不想不必要地把它们相乘
    猜你喜欢
    • 1970-01-01
    • 2021-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-14
    • 2020-01-03
    相关资源
    最近更新 更多