This script generates random commits in a Git repository over a specified date range. It creates or modifies a file and commits the changes with random timestamps, simulating activity over time.
- Generates random commit timestamps between two specified dates.
- Ensures commits are made in chronological order.
- Simulates weekend activity with reduced commit probability.
- Initializes a Git repository if one doesn't exist.
- Uses
tqdm
to display a progress bar during commit creation.
- Python 3.x
- Git
tqdm
Python package
-
Clone the repository:
git clone https://github.com/Silverbrain/mess-with-github.git cd mess-with-github
-
Install the required Python package:
pip install tqdm
-
Navigate to the directory containing the script:
cd mess-with-github
-
Run the script:
python main.py
-
random_date(start, end)
Generates a random datetime between two datetime objects. -
create_random_commit(start_date, end_date, commit_count, timezone="0000")
Creates a specified number of random commits betweenstart_date
andend_date
. -
get_random_commit_count(date)
Determines the number of random commits to create for a given date, simulating reduced activity on weekends.
- Defines the start date with setting the
date
anddelta
variable accordingly to calculates the number of days to the current date. - Initializes a Git repository if one doesn't exist.
- Iterates over each day in the date range, determining the number of commits for each day and creating them.
-
Start and End Dates: Modify the
date
variable in the__main__
block to change the start date. -
Time Zone: Adjust the
TZ
variable to set a different time zone for the commit timestamps.
This project is licensed under the MIT License.