繁体   English   中英

如何通过 Python 修改 Git 提交消息?

[英]How to amend the Git commit message through Python?

我已经使用subprocess.check_output来获取 Git 命令的结果,但我想不出如何更新我们使用命令git commit -amend所做的提交消息?

您可以将提交消息传递给git commit --amend 例如:

git commit --amend -m "This is a new commit message"

或者您可以从文件中读取新的提交消息:

git commit --amend -F commitmsg

或者您可以从stdin读取它:

echo "This is a new commit message" | git commit --amend -F-

您可以通过 Python 使用这些机制中的任何一种。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM