Backdating git commits to GitHub
November 27, 2020
I recently uploaded an old project to GitHub and had trouble setting the date to the actual date I wrote it (which I wanted to do for sentimental reasons). Effectively you are recording a commit that happened in the past. I'm recording the process here for prosperity that this is the best way to back-date a particular commit:
GIT_COMMITTER_DATE="2003-12-16 18:42:00 -0500" GIT_AUTHOR_DATE="2003-12-16 18:42:00 -0500" git commit -m "Initial commit of original source files"
It's important to note that if you merely use the --date
flag for git
, that will only set the Author Date, not the Commit Date, and GitHub will not reflect how far in the past the code dates to.
0 Comment(s)
Post a Comment