Add files to a Git repository based on specified date ranges. Tested on Linux.
This program honors all normal Git configurations, like .gitignore files and such.
pip install GitPython pytz
If the dependency GitPython
and pytz
are not available on the system, you can install them locally to an isolated Python environment.
python3 -m venv '.venv'
source .venv/bin/activate
pip install GitPython pytz
The input path argument (base folder) contains the Git repository you want to commit to.
General form (when Git has prior commits to compare against):
python git-commit-via-date-range.py /path/to/folder/with/git/repository YYYY-MM-DD <timezone>
Starting form (when the local Git repository has no prior commits):
python git-commit-via-date-range.py /path/to/folder/with/git/repository YYYY-MM-DD <timezone> YYYY-MM-DD <timezone>
Used when the Git repository has prior commits to compare against.
python git-commit-via-date-range.py /path/to/your/git/repository 2024-01-25 America/Los_Angeles
Used when the local Git repository has no prior commits.
python git-commit-via-date-range.py /path/to/your/git/repository 2024-01-25 America/Los_Angeles 2024-02-01 America/New_York
source /home/username/code/python/git-commit-via-date-range/.venv/bin/activate
python /home/username/code/python/git-commit-via-date-range/git-commit-via-date-range.py