Git:推送后更改时间戳 [英] Git: Change timestamp after pushing

查看:168
本文介绍了Git:推送后更改时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在(意外)将其推送到远程存储库之后编辑提交的时间戳?



我更改了我的系统时钟以测试我的应用中的行为,在
git add -u。 git push 之前忘了设置它。现在我的GitHub仓库显示了在一个月内编辑过的多个文件。



我遵循了建议这里 - 特别是建议 git push --force ,但不幸的是编辑日期保持不变。

解决方案

好的,那篇文章是关于更改提交消息,然后强制推送更改。但在这种情况下,首先需要在执行 git push --force 之前修复提交时间戳。

<阅读这篇文章,看看如何解决时间戳:如何更改Git中旧提交的时间戳?

然后强制推送。

(顺便说一下,在github上,在你看到这个变化之前可能需要刷新几次,并且我假设你知道你打破了历史,如果其他人克隆了回购,你打破了他们等等,对吧?好!)


How do I edit a commit's timestamp after (accidentally) pushing it to the remote repository?

I changed my system time clock to test behavior in my app, and forgot to set it back before
git add -u . and git push. Now my GitHub repo shows multiple files that were edited "in a month".

I have followed the advice here – specifically the comments to the OP that recommend git push --force, but unfortunately the edit dates stay the same.

解决方案

Well, that article is about changing the commit message, and then force pushing the change. But here in this case, you first need to fix the commit timestamp, before doing the git push --force.

Read this article to see how to fix the timestamp: How can one change the timestamp of an old commit in Git?

And then force the push.

(Btw, on github, it may take a few refreshes before you see the change. Also, I assume you know that you are breaking the history and if somebody else cloned the repo, you broke them, etc etc, right? good!)

这篇关于Git:推送后更改时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆