如何使用 shell-script 在 github "git log" 中预先修复一段文本
how to pre-fix a piece of text in github "git log" using shell-script
我需要将 github 提交(文本),从 git 命令 git log
到电子邮件中的 link。因此收件人可以单击 link 并直接转到更改。
我收到一个长列表,其中包含以下行:
commit some_long_string_of_hexadecimals
我需要将其转换为:
commit https://github.com/account/repo/commit/some_long_string_of_hexadecimals
我收到的日志包含 n 份这样的日志,因此我需要脚本为所有实例执行此操作 (some_long_string_of_hexadecimals)。
以下是一些示例日志语句:
commit a98a897a67896a987698a769786a987a6987697a6
Author: Some Person <some@email.com>
Date: Thu Sep 29 09:48:52 2016 +0200
long message describing change.
commit a98a897a67896a987698a769786a987a6987697a6
Author: Some Person <some@email.com>
Date: Thu Sep 29 09:48:52 2016 +0200
more description
我希望它看起来像这样:
commit https://github.com/account/repo/commit/a98a897a67896a987698a769786a987a6987697a6
Author: Some Person <some@email.com>
Date: Thu Sep 29 09:48:52 2016 +0200
added handling of running tests from within a docker container
如何使用 shell 命令实现此目的?
提前致谢。
awk ' == "commit" { = "https://github.com/account/repo/commit/" } 1'
检查字段 1 是否等于 "commit"
如果是,请添加到字段 2
如果行匹配,则打印修改后的行,否则按原样打印行
我需要将 github 提交(文本),从 git 命令 git log
到电子邮件中的 link。因此收件人可以单击 link 并直接转到更改。
我收到一个长列表,其中包含以下行:
commit some_long_string_of_hexadecimals
我需要将其转换为:
commit https://github.com/account/repo/commit/some_long_string_of_hexadecimals
我收到的日志包含 n 份这样的日志,因此我需要脚本为所有实例执行此操作 (some_long_string_of_hexadecimals)。
以下是一些示例日志语句:
commit a98a897a67896a987698a769786a987a6987697a6
Author: Some Person <some@email.com>
Date: Thu Sep 29 09:48:52 2016 +0200
long message describing change.
commit a98a897a67896a987698a769786a987a6987697a6
Author: Some Person <some@email.com>
Date: Thu Sep 29 09:48:52 2016 +0200
more description
我希望它看起来像这样:
commit https://github.com/account/repo/commit/a98a897a67896a987698a769786a987a6987697a6
Author: Some Person <some@email.com>
Date: Thu Sep 29 09:48:52 2016 +0200
added handling of running tests from within a docker container
如何使用 shell 命令实现此目的?
提前致谢。
awk ' == "commit" { = "https://github.com/account/repo/commit/" } 1'
检查字段 1 是否等于 "commit"
如果是,请添加到字段 2
如果行匹配,则打印修改后的行,否则按原样打印行