Git (GitHub) commit at past date

回眸只為那壹抹淺笑 提交于 2019-12-02 15:59:47
VonC

While the question "How do I make a Git commit in the past?" explains how to amend the commit author date:

git commit --amend --no-edit --date="Fri Nov 6 20:00:00 2015 -0600" 

Run that after a commit to amend the last commit with the timestamp noted.
The --no-edit will leave the message as-is.

The OP asks:

That question does not specify the GitHub result... would it work in the same way?

Yes: multiple projects exist allowing you to generate and push commits "done in the past", in order to update your contribution chart.

See for instance contribution.io or (more accurately) github-contribution.

All you need to do, is to push those amended commit on the master branch of your GitHub repo, as I mention here.

git commit --allow-empty --date="Sat Nov 14 14:00 2015 +0100" -m '2 Dec commit'

It will create empty commit with provided date

Due to the awesomeness that is Git.. if you have made a commit on that day you have it in memory and it can always be pushed at a later date for streak credit. The only tricky part about it, is remembering which repo you were working on.. on any given day.

Lets say: your project is private at the time...ASSUMING it is not licensed and it is ok to fork, clone, push to your own NEW repo..any commits from the original project will populate your contribution history.

Lets say: you have been working on a group project... You can get contributions if you are a contributor, and have made commits, by adding the project to your own repo.

There a dozens of hacky solutions to github streaks.. But let's face it...it always better to take ownership of good, original code..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!