A silly little tool to backfill your git history
Quick and dirty gettin's going...
- Create a file where you want the magic to happen
- example
touch temp_updater.sh
- example
- Get the contents of the bash script and place them in
temp_updater.sh
- Make the file executable
chmod +x temp_updater.sh
- Edit the file, paying attention to
DAYSOFFSET=10
This is how many days back you want to start from, default is to start from 10 days agoDAYSTORUN=5
This is how many days will get updatedPOSSIBLEUPDATESPERDAY=7
This is most possible per day, but the actual number is randomized from 1 to what this is set toTIMEZONEOFFSET="-0400"
This is the end of the date. If you are not sure what yours is, typegit log
and you'll see it there- Decide which file to update and update it. There are two places, currently it's set to
readme.md
. What happens is the script will add a line to the end of the file, something like3 of 3 @ Mon May 27 18:44:02 2013
which is the update of how many total updates for that day, and the date. This is the change that gets submitted. That line is removed and replaced with each commit. - I also suggest that unless you want
temp_updater.sh
in your repo, you add it to your.gitignore
file - Finally, towards the end of the file, there are the git commands, currently commented out for your safety and mine. Before you uncomment, check to make sure you are going to get what you want. Do that by typing in the command
./temp_updater
and you will get a readout of each day it processes and how many commits that push would have received. Of course, it's random, so it won't be that same number when you run it again. Uncomment thegit add --all
andgit commit ...
lines, and you, my friend, are a git history revisionist.
- Do a
git push
- Oh! And the changes won't show up in github until the following day. So don't freak out. [This may not be true anymore. I just ran it again to test and it showed up right away.] However, It does seem that if you go fo a super long period of time, the newest days start dropping off. Not sure if this is a limitation on the commits per push or what.
- And just to be sure, when you are finished, in your command-line, run
export GIT_AUTHOR_DATE=""
andexport GIT_COMMITTER_DATE=""
just to make sure those are reset back to default
This script changes things, and does so automatically. So, you should probably be careful, and know that running it could cause problems on your computer up to and including physical death. So know that I wring my hands of any responsibility and my conscious is clear.
MIT license seems like a good idea. If you make changes and improvements, it would be awesome if you let me know so I can possibly use them.