4

When merging two files, does git take into account which file is newer and which one is older? If yes, what happens with timezones, what if one user has an older file but their timezone makes it look newer?

exebook
  • 32,014
  • 33
  • 141
  • 226
  • @castis so can the timezone delta be a problem with commit timestamps? – exebook Sep 09 '18 at 16:01
  • 1
    As I say that I realize I am wrong. Timestamps are probably not even involved in the merge process. Every commit is based on an earlier commit so the only thing that matters is that the commits existed beforehand. [Check out this other answer](https://stackoverflow.com/questions/9105465/timestamps-in-git) – castis Sep 09 '18 at 16:03

1 Answers1

5

so can the timezone delta be a problem with commit timestamps

No: only the graph of commit matters, whatever their associated date is.
A commit can in theory have a parent commit created after said commit (instead of before): the date is an arbitrary metadata you associate to a commit when you create it, like the author string. (see for instance the GIT_AUTHOR_DATE and GIT_COMMITER_DATE environment variables)

The recent (Q2 2018) commit-graph feature from Microsoft does not depend on dates at all, for instance. (see Git Commit Graph Design Notes)

See more with "“Chronological” ordering: time is an illusion; log time, doubly so".

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250