git squash and preserve last commit's timestamp

Posted by Crend King on Stack Overflow See other posts from Stack Overflow or by Crend King
Published on 2012-04-04T23:24:31Z Indexed on 2012/04/04 23:29 UTC
Read the original article Hit count: 187

Filed under:

Consider I have commits

... -- A -- B -- C

If I use git rebase -i to squash all three commits into one, we could

pick A
squash B
squash C

I see the resulted commit A has its original timestamp. How could make it inherit the timestamp of commit C (the last one)?

What I can think of is git commit --amend --date=<new_time>, but I need to remember the timestamp of commit C before squash or from reflog.

I find the timestamp of the latest timestamp is more reasonable, because it show when do I actually finish the work that are in the commits.

Thanks.

© Stack Overflow or respective owner

Related posts about git