There are days when I get so caught up in coding/debugging/messing around that I forget to commit. It's easy to lose track of time when you're in the zone, and sometimes, committing just doesn't seem like the top priority at the moment. That's where this script comes in. I started using WakaTime back at the end of August, and I realized that I could use this data to fill in the gaps in my GitHub commit history.
This script cross-references the days I've coded (as per WakaTime) with the days I've actually made commits on GitHub. If it finds a day with coding activity but no commits, it automatically generates a commit for that day. This repository's commit history is a result of this script, which you might find useful if you also tend to forget to commit during those deep work sessions.
To use this script, you should have Node.js installed. Here's how to set it up:
-
Clone the Repository:
git clone https://github.com/Keyrxng/WakaCommits
-
Install Dependencies:
yarn install
-
Set Up Environment Variables:
cp .env.example .env
Then, open
.env
and fill in the values for the following variables:GITHUB_TOKEN
: Your GitHub personal access token. You can find it hereWAKATIME_API_KEY
: Your WakaTime API key. You can find it here.GITHUB_USERNAME
: Your GitHub username.COMMIT_START_DATE
The date you want to start backfilling commits from. This should be in the formatYYYY-MM-DDT00:00:00Z
. -
Run the Script:
yarn build && yarn start
-
Push the Commits:
git remote add origin <your-repo-url> && git push -u origin master
- This is not a tool for generating fake commits. It's meant to be used as a last resort for those days when you forget to commit.
- This in not a commit history spoofer or fabricator, this relies on your WakaTime data to generate commits.
- This is not a replacement for good commit hygiene. It's not a good idea to use this script as a crutch to avoid committing regularly. Instead, it should be used as a last resort for those days when you forget to commit.