This project is a small starter tool for exploring how a function evolved over time in a GitHub repository.
- Clones or reuses a local checkout of a Git repository.
- Retrieves commit history from that repository.
- Filters commits to those likely related to a given function name.
- Prints a compact timeline you can build on later.
- Optionally asks an LLM to explain how the function evolved across those commits.
src/repo_history/git_tools.py: Git clone and log retrieval helpers.src/repo_history/function_history.py: Function-oriented commit filtering logic.src/repo_history/cli.py: Command-line entrypoint.
python3 -m src.repo_history.cli \
--repo-url https://github.com/pallets/flask.git \
--function-name routeSet an API key and model first:
export OPENAI_API_KEY=your_api_key
export OPENAI_MODEL=your_model_idThen run:
python3 -m src.repo_history.cli \
--repo-url https://github.com/pallets/flask.git \
--function-name route \
--explain-with-aiUseful flags:
--show-patches: print full matching patches in the terminal--ai-model: overrideOPENAI_MODELfor one run--ai-base-url: point at an OpenAI-compatible API endpoint--ai-max-commits: limit how many matching commits are sent to the model--ai-max-patch-chars: truncate each patch before it is added to the prompt
This version uses git log -S to find commits where the exact function name text changed. That is a useful baseline, but it is not perfect:
- It may miss refactors where the function moved without the name text changing.
- It may include unrelated uses of the same name.
- It does not yet parse language syntax.
- The AI explanation is only as good as the commits surfaced by that search strategy.