gpt4 book ai didi

git - 如何在不更改日期的情况下编辑提交作者?

转载 作者:行者123 更新时间:2023-12-04 14:18:48 24 4
gpt4 key购买 nike

我已经知道如何更改提交的作者(作者和提交字段),

git rebase --root --exec "git commit --amend --reset-author --no-edit"

但是随着作者的更改,日期(作者日期和提交日期)从当前日期开始更改。如何保存旧日期并同时更改作者?

最佳答案

这不是您问题的完整解决方案,因为提交日期仍在更新(毕竟这确实会更改提交),但它可能适合只想保持作者日期不变的任何人。

而不是使用 --reset-author还更新作者日期,您可以明确设置作者。

git rebase --root --exec "git commit --amend --author=John --no-edit"

您可以明确指定作者想要的内容,或使用使用搜索模式(这就是上面的示例所做的)。

--author=

Override the commit author. Specify an explicit author using the standard A U Thor format. Otherwise is assumed to be a pattern and is used to search for an existing commit by that author (i.e. rev-list --all -i --author=); the commit author is then copied from the first such commit found.



Source

关于git - 如何在不更改日期的情况下编辑提交作者?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57280172/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com