Skip to main content

A tool to visualize the commit history of a Git repository.

Project description

Commit Cartographer

A Python tool that generates visual flowcharts of Git repository activity by analyzing commit patterns across directories.

Features

  • ๐Ÿ” Intelligent Analysis: Counts commits per directory while focusing only on currently existing structure
  • ๐Ÿ“Š Visual Representation: Generates Mermaid flowcharts with directory relationships
  • ๐ŸŽจ Color Gradients: Uses a 10-step color gradient to represent commit density
  • ๐ŸŒณ Directory Depth: Supports up to 4 levels of directory nesting
  • ๐Ÿ“ Repository Structure: Shows parent-child relationships between directories

Installation

To use this project, ensure you have uv installed.

Usage

To run the tool, execute the following command in your terminal:

uv run commit-cartographer/cli.py [path_to_your_repo]

If no path is provided, it defaults to the current directory.

Output

The script generates a Markdown file named git_activity.md, which contains the Mermaid flowchart diagram representing the commit activity in the specified Git repository.

Example

After running the script, you will find a git_activity.md file with content similar to the following:

flowchart LR
    root_node[/root\]
    style root_node fill:#ffffff,stroke:#333,stroke-width:2px
    root_node --> node_src[/src\]
    style node_src fill:#ff00ff,stroke:#333,stroke-width:2px
    root_node --> node_cla[/cla\]
    style node_cla fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_aws[/aws\]
    style node_src_aws fill:#55aaff,stroke:#333,stroke-width:2px
    root_node --> node_icons[/icons\]
    style node_icons fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_php[/php\]
    style node_src_php fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_az[/az\]
    style node_src_az fill:#00ffff,stroke:#333,stroke-width:2px
    node_src_az --> node_src_az_2.53.0[/2.53.0\]
    style node_src_az_2.53.0 fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_heroku[/heroku\]
    style node_src_heroku fill:#00ffff,stroke:#333,stroke-width:2px
    root_node --> node_.vscode[/.vscode\]
    style node_.vscode fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_infracost[/infracost\]
    style node_src_infracost fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_fig[/fig\]
    style node_src_fig fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_usermn[/usermn\]
    style node_src_usermn fill:#00ffff,stroke:#333,stroke-width:2px
    node_src_usermn --> node_src_usermn_sdc[/sdc\]
    style node_src_usermn_sdc fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_deno[/deno\]
    style node_src_deno fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_dotnet[/dotnet\]
    style node_src_dotnet fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_example[/example\]
    style node_src_example fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_shopify[/shopify\]
    style node_src_shopify fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_task[/task\]
    style node_src_task fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_capgo[/capgo\]
    style node_src_capgo fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_wordpress[/wordpress\]
    style node_src_wordpress fill:#00ffff,stroke:#333,stroke-width:2px
    root_node --> node_.devcontainer[/.devcontainer\]
    style node_.devcontainer fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_magnolia[/magnolia\]
    style node_src_magnolia fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_gcloud[/gcloud\]
    style node_src_gcloud fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_python[/python\]
    style node_src_python fill:#00ffff,stroke:#333,stroke-width:2px
    node_src --> node_src_preset[/preset\]
    style node_src_preset fill:#00ffff,stroke:#333,stroke-width:2px
    root_node --> node_.husky[/.husky\]
    style node_.husky fill:#00ffff,stroke:#333,stroke-width:2px

You can also add the --style option to generate a tree diagram:

uv run commit-cartographer/cli.py [path_to_your_repo] --style tree
root/
โ””โ”€โ”€ orchestration/ (26 commits)
    โ””โ”€โ”€ assets/ (20 commits)
        โ””โ”€โ”€ dbt/ (4 commits)
        โ””โ”€โ”€ ebirdapi/ (14 commits)
            โ””โ”€โ”€ .dlt/ (2 commits)
            โ””โ”€โ”€ schemas/ (4 commits)
                โ””โ”€โ”€ export/ (2 commits)
                โ””โ”€โ”€ import/ (2 commits)
    โ””โ”€โ”€ utils/ (2 commits)
โ””โ”€โ”€ orchestration_tests/ (4 commits)
โ””โ”€โ”€ schemas/ (10 commits)
    โ””โ”€โ”€ export/ (5 commits)
    โ””โ”€โ”€ import/ (5 commits)
โ””โ”€โ”€ scripts/ (3 commits)
โ””โ”€โ”€ transformation/ (57 commits)
    โ””โ”€โ”€ analyses/ (1 commits)
    โ””โ”€โ”€ macros/ (1 commits)
    โ””โ”€โ”€ models/ (43 commits)
        โ””โ”€โ”€ sources/ (6 commits)
            โ””โ”€โ”€ ebirdapi/ (6 commits)
        โ””โ”€โ”€ staging/ (37 commits)
            โ””โ”€โ”€ docs/ (21 commits)
    โ””โ”€โ”€ seeds/ (1 commits)
    โ””โ”€โ”€ snapshots/ (1 commits)
    โ””โ”€โ”€ tests/ (1 commits)

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any suggestions or improvements.

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

commit_cartographer-0.1.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

commit_cartographer-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file commit_cartographer-0.1.1.tar.gz.

File metadata

  • Download URL: commit_cartographer-0.1.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.25

File hashes

Hashes for commit_cartographer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3b7ebf181a7f7a48783ddc4f9328674d5fc0e51f2c114fb4bd626d0691e5ad79
MD5 b90e44722fc63db7bdb03095810db1e1
BLAKE2b-256 4acfeff758572b174037ec36d8fbea6aef3b2b07771a767c659b58fd6eab89c4

See more details on using hashes here.

File details

Details for the file commit_cartographer-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for commit_cartographer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 91c93c12580c230f9d6f7373cabbe68f6f2b3abd2c03abf704d35c103f1ba605
MD5 b1e953bc11db3cfbc594638967b9107e
BLAKE2b-256 75709471593ce813143cfe254d8e91e555bf4b547f3ed98a09f20bb8f5cec1f9

See more details on using hashes here.

Supported by

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