Git修改旧提交的时间
如果要更改最近6次提交的作者日期和提交者日期,可以使用交互式rebase:
git rebase -i HEAD~6
pick c95a4b7 Modification 1 pick 1bc0b44 Modification 2 pick de19ad3 Modification 3 pick c110e7e Modification 4 pick 342256c Modification 5 pick 5108205 Modification 6 # Rebase eadedca..5108205 onto eadedca (6 commands) # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # d, drop = remove commit
对于要更改日期的所有提交,请将git status
替换为edit
(或仅更改为e
),然后保存并退出编辑器。
您现在可以通过以ISO-8601格式指定作者日期和提交者日期来修改每个提交:
GIT_COMMITTER_DATE="2017-10-08T09:51:07" git commit --amend --date="2017-10-08T09:51:07"
第一个日期是提交日期,第二个日期是作者日期。
然后转到下一个提交:
git rebase --continue
重复此过程,直到您修改所有提交。 通过git status
查看您的进展。
联系方式:emhhbmdfbGlhbmcxOTkxQDEyNi5jb20=
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2017-06-17 Construct Binary Tree from Inorder and Postorder Traversal ——通过中序、后序遍历得到二叉树
2017-06-17 c++对象内存模型【内存布局】(转)
2017-06-17 C++继承:公有,私有,保护(转)