git rebase without changing commit timestamps
Posted
by Olivier
on Stack Overflow
See other posts from Stack Overflow
or by Olivier
Published on 2010-06-04T12:20:27Z
Indexed on
2010/06/05
8:52 UTC
Read the original article
Hit count: 278
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?
Edit
A crucial question of Von C helped me understand what is going on: when your rebase, the committer's timestamp changes, but not the author's timestamp, which suddenly all makes sense. So my question was actually not precise enough. The answer is that rebase actually doesn't change the author's timestamps (you don't need to do anything for that), which suits me perfectly.
© Stack Overflow or respective owner