修改时更新git commit author date [英] Update git commit author date when amending
问题描述
您可以使用 - date
参数为 git commit
。因此,如果您想修改上次提交,并将其作者日期更新为当前日期和时间,则可以执行以下操作:
git commit --amend --date =$(date -R)
code> -R 参数给 date
告诉它以RFC 2822格式输出日期,这是由 git commit
理解的日期格式。)
I found myself amending my commits quite often. I don't stash
so much because I tend to forget I did so, especially when I want to save what I did before I leave or before a weekend, so I do a "draft" commit. Only thing is, when I amend the commit, it is still set to the original author date. Is there a (simple) way to update it when amending?
You can change the author date with the --date
parameter to git commit
. So, if you want to amend the last commit, and update its author date to the current date and time, you can do:
git commit --amend --date="$(date -R)"
(The -R
parameter to date
tells it to output the date in RFC 2822 format. This is one of the date formats understood by git commit
.)
这篇关于修改时更新git commit author date的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!