bash - 打开一个新的 git-bash 终端并在其中运行命令
问题描述
我设置了一个预提交挂钩来在 git 中运行单元测试。这意味着每次我运行 git commit 命令时,它都会自动运行 pytest。
但是,这会使我的 git-bash 终端停止一段时间。我想要一个命令来打开一个新的 git-bash 窗口并在其中自动运行 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>
我会在脚本中添加一个 sleep 命令,以便您查看任何结果。
推荐阅读
- mkdocs - mkdocs 中带有 markdown_include.include 的相对链接(到标题)
- python - 精度和召回率的几何平均值
- asp.net-core - Asp.net 核心未使用正确的证书
- terraform - 使用 terraform 将对象(地图)转换为不同的列表
- delphi - 德尔福的 Round() 似乎是不确定的
- javascript - 在异步函数中捕获异步函数中的错误
- angular - 使用角度平移作为通知函数的参数
- spring-boot - java.net.UnknownHostException:host.docker.internal:AWS EC2 上的名称或服务未知
- python - 在python中分隔“\”之前的所有值 - 扫描字符串文字时的EOL
- ffmpeg - ffmpeg 添加标志和照片和字幕