打开一个新的 git-bash 终端和其中的 运行 命令

Open a new git-bash terminal and run commands in it

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

但是,这会使我的 git-bash 终端停止一段时间。 我想要一个命令,它将自动打开一个新的 git-bash window 和 运行 git commit -m $mycomment。

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

您可以将命令放在 bash shell 脚本中。我们称它为:<脚本名称>.

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

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