Atlassian Stash shows when a change was committed locally and not when it was pushed to the Stash repository

StackOverflow https://stackoverflow.com/questions/12266040

  •  30-06-2021
  •  | 
  •  

Question

Screenshot from Atlassian Stash

Stash says the latest commit was committed 8 minutes ago. That was when I committed the change locally. I then pushed the changes to the Stash repository 7 minutes later (1 minute before the screenshot).

I'm somewhat surprised that it is the local commit date that's being used. Is that really how it should be?

Was it helpful?

Solution

In Git commits are immutable. Each commit consists of

top-level tree for the snapshot of the project at that point; the author/committer information pulled from your user.name and user.email configuration settings, with the current timestamp; a blank line, and then the commit message.

Push (emphasis mine)

Updates remote refs using local refs, while sending objects necessary to complete the given refs.

Since push sends your objects to the server, and your objects captures the time stamp of the commit; logically the only thing the server would be able to do is show you is the captured timestamp.

There are two ways Stash would be able to show you the time of the push.

  1. Modify the commits and update the time stamp on them (this may not be the worst idea in the world, but it's pretty close).
  2. Maintain its own set of times stamps of when a particular commit was pushed and display that information in addition to what was recorded into the commit. This is doable, but it's extra work and the benefit isn't immediately obvious.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top