0

I did a lot of academic work over the past few months that I was not able to release on Github because it was sensitive. I now have authorization to release it, but I have not been committing the documents sequentially. I want to go back and order these documents dates in such a way that they will show up on my contribution chart for the day I specified.

I thought this would be simple but every thread I find on rewriting history is unclear and very technical. This thread talks about modifying history but does not really say the exact syntax to use or why it works.

Evidently GIT_AUTHOR_DATE and GIT_COMMITTER_DATE are variables stored on a commit object. I read that these variables are what will modify my contributions chart. How do I modify these directly?

Community
  • 1
  • 1
chopper draw lion4
  • 12,401
  • 13
  • 53
  • 100
  • 1
    Nothing can modify history, all you can do is add new history and switch labels around. Everybody who has the older history keeps it and can detect the switch as soon as they see it. Read up on `git filter-branch`, I think you're going to have to be more concrete about where the answer you linked is failing you. (edit: if you don't mind doing the commits individually I'd do what @hobbs's answer says) – jthill Dec 17 '14 at 02:21
  • Duplicate of http://stackoverflow.com/questions/454734/how-can-one-change-the-timestamp-of-an-old-commit-in-git ? – Magnus Bäck Dec 17 '14 at 07:01

1 Answers1

1

You want to use git rebase --interactive to be able to re-order and possibly split the commits. You need to edit the commits even if you're not changing the file contents so that you can change the date on them. Then you can set GIT_AUTHOR_DATE in the shell when you git rebase --continue, which will get passed on to git commit. Rebase automatically sets the commit date to the time of the rebase, which is a perfectly good idea so you should probably let it be.

hobbs
  • 223,387
  • 19
  • 210
  • 288
  • Changing the author date does not change my contributions calendar. I want to change my contributions calendar so I can display a balanced distribution of work and not have a three month gap in my portfolio. Is there no way to do this without hacking it? – chopper draw lion4 Dec 17 '14 at 03:45