模拟真实的 GitHub 提交记录,支持自定义时间范围和多种贡献强度模式。
- 🎯 三种贡献强度:轻量(light)、中等(medium)、重度(heavy)
- 📅 自定义时间范围:支持从任意年份开始
- 🎲 真实随机性:工作日更多提交,周末减少,偶尔爆发
- ⏰ 合理时间分布:集中在工作时间(9-18点),符合真实习惯
- 📝 智能提交信息:自动生成符合规范的提交信息
- 📊 详细统计:生成提交分布图表
- 🔧 Git 集成:直接生成带时间戳的 Git 提交
python simulator.py --start 2023-01-01 --intensity medium# 创建新仓库并填充提交
python generate_commits.py --start 2020-01-01 --repo ./my-project
# 使用已有仓库
python generate_commits.py --start 2021-06-01 --repo ./existing-project --intensity heavypython generate_commits.py \
--start 2020-01-01 \
--repo ./project \
--remote https://github.com/username/repo.git \
--push仅生成提交计划,不创建实际 Git 提交:
# 基础用法
python simulator.py --start 2023-01-01
# 指定结束日期
python simulator.py --start 2023-01-01 --end 2023-12-31
# 选择强度
python simulator.py --start 2023-01-01 --intensity heavy
# 导出为 JSON
python simulator.py --start 2023-01-01 --export commits.json
# 仅显示统计
python simulator.py --start 2023-01-01 --stats-only
# 固定随机种子(可复现)
python simulator.py --start 2023-01-01 --seed 42生成实际的 Git 提交:
# 基础用法
python generate_commits.py --start 2023-01-01
# 指定仓库路径
python generate_commits.py --start 2023-01-01 --repo ./my-repo
# 添加远程仓库
python generate_commits.py --start 2023-01-01 --remote https://github.com/user/repo.git
# 生成后自动推送
python generate_commits.py --start 2023-01-01 --push
# 干运行(预览但不执行)
python generate_commits.py --start 2023-01-01 --dry-run
# 强制推送(谨慎使用)
python generate_commits.py --start 2023-01-01 --push --force| 模式 | 每日提交概率 | 平均提交数 | 最大提交数 | 爆发概率 |
|---|---|---|---|---|
| light | 40% | 1.5 | 4 | 5% |
| medium | 70% | 3 | 8 | 10% |
| heavy | 90% | 5 | 15 | 15% |
周末自动减少: 周末提交概率会乘以 reduction 系数
爆发模式: 偶尔会出现高强度提交日,模拟赶 deadline 的情况
🎯 Simulating medium contributor from 2023-01-01 to 2024-02-14...
📊 Statistics:
Total commits: 847
Active days: 298
Avg commits per active day: 2.8
Max commits in a day: 8
📅 Commits by weekday:
Mon: 156 █████████████████████████████
Tue: 168 ████████████████████████████████
Wed: 145 ███████████████████████████
Thu: 152 █████████████████████████████
Fri: 134 █████████████████████████
Sat: 52 █████████
Sun: 40 ███████
📝 First 10 commits:
2023-01-03 10:23 - feat: implement API for clarity
2023-01-03 14:15 - fix: update validation
2023-01-04 09:45 - docs: add README per review comments
... and 837 more
- 不可逆操作:生成的 Git 提交会永久改变仓库历史
- force push:使用
--force会覆盖远程历史,谨慎操作 - GitHub 限制:GitHub 贡献图只显示最近一年的数据
- 时间一致性:提交时间完全基于系统时间,确保正确设置时区
- 建议在私有仓库测试后再用于公开仓库
- 不要在已协作的仓库上使用,会改变共享历史
- 使用
--dry-run先预览效果
MIT License - 自由使用,后果自负 😄
欢迎提交 Issue 和 PR!