1

Let's assume that a series of commits were made throughout the day:

[1:00pm] $ commit -am "commit 1"
[2:00pm] $ commit -am "commit 2"
[3:00pm] $ commit -am "commit 3"

Instead of pushing all of these commits at once, I would like to replay the commits, while pushing each one at delayed times.

How can I push each commit one at a time with new future time stamps, so that it appears to the upstream, that changes are being worked on live?

[1:00pm] $ commit -am "commit 1"
[2:00pm] $ commit -am "commit 2"
[3:00pm] $ commit -am "commit 3"

[3:00pm] $ ./begin-pushing

[4:00pm] $ push; #upstream sees commit 1 was done at 4:00pm
[5:00pm] $ push; #upstream sees commit 2 was done at 5:00pm
[6:00pm] $ push; #upstream sees commit 3 was done at 6:00pm
Trevor Hickey
  • 36,288
  • 32
  • 162
  • 271
  • One of the fundamental aspects of Git is that when a commit is made, everything about that commit (including the timestamps) is set in stone. Changing any information (such as a timestamp) requires creating a new commit with a new identity (new sha1) which reflect your new desired timestamp information. – Greg Hewgill Aug 10 '15 at 02:27
  • @GregHewgill I agree that this is not something very common in normal git workflows. However, a lot of people already do similar behaviour when rewinding with rebase. My commits in this situation are less 'set in stone', because they have not yet been pushed upstream. – Trevor Hickey Aug 10 '15 at 02:35
  • 1
    Ok, sure you could certainly use rebase for this. See [Change timestamps while rebasing git branch](https://stackoverflow.com/questions/1579643/change-timestamps-while-rebasing-git-branch) for example. – Greg Hewgill Aug 10 '15 at 02:37
  • 1
    Why do you want this? – Schwern Aug 10 '15 at 04:01
  • In addition to the comment by @GregHewgill you may find more example here http://stackoverflow.com/questions/454734/how-can-one-change-the-timestamp-of-an-old-commit-in-git – joran Aug 10 '15 at 06:15

0 Answers0