1

Hello there I Would like to know how to fix this. I would like to be able to see when is the last time my account have commited/push on my github repo.

but the problem is I have commited 20-24hrs ago by the time I've asked this question. right now github will not show the time it only shows "latest commit a day from now". enter image description here

is there a way to fix this something like "commit 21hrs ago" some thing like that?

Evan
  • 2,327
  • 5
  • 31
  • 63

1 Answers1

2

You could amend the date of your latest commit, and the force push.

GIT_COMMITTER_DATE="Mon 20 Aug 2018 20:19:19 BST" git commit --amend --no-edit --date "Mon 20 Aug 2018 20:19:19 BST"
git push ---force

Warning: make sure to advertise that forced push to any contributor to that repo: they will have to reset their master branch to the new origin/master.

See also "Update git commit author date when amending"

git commit --amend --date="$(date -R)" # or another date

Again, a force push is needed.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • before when I write command in my cmd with only "git push" it works fine. github will automatically shows the time. but right now I will need to for force push everytime?. – Evan Apr 10 '19 at 04:42
  • @Vanz No: you need to force push when you amend commit(s) locally that were already pushed. Once you have forced push that new history, the next new commits will be pushed with a regular git push. – VonC Apr 10 '19 at 04:43
  • but why was it saying "a day from now" it seems like referring to the future? in my other repo this does not happen. – Evan Apr 10 '19 at 04:58
  • 1
    @Vanz The commit date can be set to any date. If that date was shifted somehow to one day in the future, that is what GitHub would reflect. Why the date was off? I don't know. But as far as Git is concerned, it is just a metadata added to the commit (like the user name/email) – VonC Apr 10 '19 at 05:12
  • maybe my machine is the problem. yes thank you I learned a lot. – Evan Apr 10 '19 at 05:16