git rebase without changing commit timestamps

Would it make sense to perform git rebase while preserving the commit timestamps?

I believe a consequence would be that the new branch will not necessarily have commit dates chronologically. Is that theoretically possible at all? (e.g. using plumbing commands; just curious here)

If it is theoretically possible, then is it possible in practice with rebase, not to change the timestamps?

For example, assume I have the following tree:

master <jun 2010>
  |
  :
  :
  :     oldbranch <feb 1984>
  :     /
oldcommit <jan 1984>

Now, if I rebase oldbranch on master, the date of the commit changes from feb 1984 to jun 2010. Is it possible to change that behaviour so that the commit timestamp is not changed? In the end I would thus obtain:

      oldbranch <feb 1984>
      /
 master <jun 2010>
    |
    :

Would that make sense at all? Is it even allowed in git to have a history where an old commit has a more recent commit as a parent?

6 Answers
6

Leave a Comment