Skip to main content

it is time to tell a git story

Project description

GitStory

GitStory is a Python tool designed to extract and process git commit history from a repository. It generates a structured summary of commits, allowing for custom processing of changes using functions like LLM summarizers. This facilitates deeper insights into the development process by capturing not just what changed, but also the intent, mistakes, and context behind each commit.

Features

  • Extract Commit Information: Retrieves commit date, message, and changes per file.
  • Custom Processing: Integrates with custom functions (e.g., LLM summarizers) to process commit diffs.
  • Structured Output: Generates dictionaries with fields like date, message, change_summary, aim, mistakes, and project_context.
  • Extensible: Easily modify or extend to include additional commit metadata.
  • No Branch Complexity: Assumes all commits are merged into the main branch, simplifying the commit history.

Installation

  1. Clone the Repository

    git clone https://github.com/yourusername/gitstory.git
    
  2. Navigate to the Directory

    cd gitstory
    
  3. Install Dependencies

    GitStory uses Python's standard library modules, but if your custom processing functions require additional packages, install them using:

    pip install -r requirements.txt
    

    Note: Ensure you have Python 3.6 or higher installed.

Usage

Basic Usage

Run the script in the root directory of the git repository you want to analyze:

python gitstory.py

This will generate a commits.json file containing the extracted commit data with the following structure:

[
  {
    "date": "2023-10-01 12:34:56 +0000",
    "message": "Initial commit",
    "change_summary": "Changes in README.md",
    "aim": "",
    "mistakes": "",
    "project_context": ""
  },
  {
    "date": "2023-10-02 14:20:10 +0000",
    "message": "Added new feature",
    "change_summary": "Changes in feature.py",
    "aim": "",
    "mistakes": "",
    "project_context": ""
  }
]

Customizing Processing Functions

To integrate your custom processing logic (e.g., LLM summarizer), modify the process_changes function in gitstory.py:

def process_changes(commit_hash, changed_files):
    change_summaries = []
    for file in changed_files:
        diff = get_diff_for_file(commit_hash, file)
        # Integrate your custom function here
        summary = your_custom_function(diff)
        change_summaries.append(summary)
    return ' '.join(change_summaries)

Replace your_custom_function with your actual processing function.

Configuration

  • Custom Functions: Replace placeholders with your own logic for processing diffs.
  • Output Format: Modify the commit dictionary structure in gitstory.py to include additional fields if needed.
  • Data Storage: By default, the output is saved to commits.json. Change the filename or storage mechanism as desired.

Examples

Running with Default Settings

python gitstory.py

Integrating an LLM Summarizer

def process_changes(commit_hash, changed_files):
    change_summaries = []
    for file in changed_files:
        diff = get_diff_for_file(commit_hash, file)
        # Example integration with an LLM summarizer
        summary = llm_summarizer.summarize(diff)
        change_summaries.append(summary)
    return ' '.join(change_summaries)

Sample Output

After running the script with your custom processing, commits.json might look like:

[
  
    "date": "2023-10-01 12:34:56 +0000",
    "message": "Initial commit",
    "change_summary": "Set up project structure and added initial files.",
    "aim": "Establish the foundation for the project.",
    "mistakes": "Forgot to include .gitignore.",
    "project_context": "Starting the GitStory project to track commit histories."
  
  
]

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the Repository

  2. Create a Feature Branch

    git checkout -b feature/your-feature-name
    
  3. Commit Your Changes

    git commit -m "Description of your feature"
    
  4. Push to Your Fork

    git push origin feature/your-feature-name
    
  5. Open a Pull Request

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or support, please open an issue on the GitHub repository or contact the maintainer:


GitStory helps you narrate the evolution of your codebase by enriching commit history with meaningful summaries and insights.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

biography-0.0.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

biography-0.0.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file biography-0.0.0.tar.gz.

File metadata

  • Download URL: biography-0.0.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for biography-0.0.0.tar.gz
Algorithm Hash digest
SHA256 d402715852b3407d6095d079cc51e6458c11e8279e58facf46b03b17ed6b8f6d
MD5 7fe0d4b8f043399ef5f4cc64afd71a05
BLAKE2b-256 f4edc1feec6a2ba9242fa7d69db08d8678ac9a63647c2eb94252f3e09e8dca0e

See more details on using hashes here.

File details

Details for the file biography-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: biography-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for biography-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b53310ae0858a4e0035c37a901a507bcedb160417d697347584f54d1bea15c1
MD5 3873e1f59f99e0e5f45cd9c1fa0bdfd9
BLAKE2b-256 55699ec89b187eaa55285e01d328fdc38f2e5442345ab3b9f0ce2c0c044e2002

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page