This project automates daily commits to keep your GitHub contribution graph active. It generates a new commit each day with a unique message, pushes it to the repository, and handles potential conflicts automatically.
- Automated Daily Commits: Automatically commits a file (
temp.txt
) with a new timestamp every day. - Conflict Handling: Resolves conflicts by force-syncing the local branch with the remote branch before each commit.
- Customizable: Easily adjust the commit message or modify the content of each commit.
-
Clone the Repository:
git clone git@github.com:kaneAmiller/daily-commits.git cd daily-commits
-
Install Node.js: Make sure you have Node.js installed to run the script. Download Node.js here.
-
Set Up GitHub SSH Authentication:
- Generate an SSH key if you haven't already.
- Add the key to your GitHub account.
-
Edit
dailyCommit.js
(Optional):- By default, the script creates a unique message using the current date and time.
- If you want to change the commit message format, update the
message
variable indailyCommit.js
.
To run the script manually, navigate to the project directory and execute:
node dailyCommit.js
This will:
- Force-sync the local branch with the remote branch.
- Generate a new commit message with the current date and time.
- Push the new commit to the GitHub repository.
To run this script automatically every day, set up a cron job:
-
Open your crontab:
crontab -e
-
Add the following line to schedule the script to run daily at 9 AM:
0 9 * * * /usr/local/bin/node /path/to/dailyCommit.js
Replace
/path/to/dailyCommit.js
with the full path to yourdailyCommit.js
file.
- Open Task Scheduler.
- Create a new task with the following settings:
- Trigger: Daily at your preferred time.
- Action: Start a Program.
- Program: Path to
node.exe
, usuallyC:\Program Files\nodejs\node.exe
. - Arguments: Full path to
dailyCommit.js
, e.g.,C:\path\to\dailyCommit.js
.
- Change Commit Message: Update the
message
variable indailyCommit.js
to customize the commit message format. - File Content: The script writes a new message to
temp.txt
daily. You can modify this to add different content or even add more files if needed.
- Conflict Issues: This script uses
git reset --hard
to resolve conflicts by syncing the local branch with the remote branch before each commit. - GitHub Authentication: Make sure your SSH key is properly set up on GitHub if you encounter authentication issues.
This project is licensed under the MIT License.