gpt4 book ai didi

linux - 如何自动编辑 "git-rebase -i"之后的提交?

转载 作者:太空狗 更新时间:2023-10-29 12:13:01 24 4
gpt4 key购买 nike

我经常需要更改 n 之前提交的日期。通常我执行 git rebase -i @~20 然后在编辑器中手动将 pick 更改为 edit,然后在循环 commit --amend 中运行所需的 date。一切都很好,但我想自动化该过程,以便根本不会调用编辑器。

问题是:如何在 git rebase 之后自动切换到“edit 模式”?

最佳答案

您可以编写一个像编辑器一样运行并执行您想要的操作的脚本(它将使用一个临时文件调用并修改它),然后使用它运行 rebase - EDITOR=/path/to/你的/脚本 git rebase -i @~20

您可能还想查看 How can one change the timestamp of an old commit in Git? 中建议的 git filter-branch 方法

关于linux - 如何自动编辑 "git-rebase -i"之后的提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35240022/

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