Skip to main content

Git extension for reporting source code line lifetime and churn

Project description

git-hot

git-hot is a Git extension that reports how ``hot'' (often-changing) the current lines or files in a repository are. It derives line lifetime and churn information from Git history, then highlights files and lines that have changed often or recently.

Install the package and run it as either:

git hot
git-hot

The package installs two commands:

  • git-hot, the Git extension command; manual page.
  • daglp, a helper, written in Rust, used to compute the longest path through the Git commit DAG; manual page.

Installation

For an isolated command installation:

uv tool install git-hot

For installation in an active virtual environment:

uv pip install git-hot

With pip:

python -m pip install git-hot

After installation, ensure the installation's script directory is on PATH so Git can find git-hot and you can invoke it as git hot.

Usage

Show hot files in the current repository:

git hot

Show hot files at a specific revision:

git hot HEAD

Show line-level churn for one file:

git hot -- src/main.py

Show line ages and birth commits for one file:

git hot -q --format '{days(age)} {hash[:7]} {line}' -- src/main.py

Reconstruct all source files with churn prefixes below a directory:

git hot --dir hot-tree HEAD

Output

Without a path, git hot prints one line per current source file, sorted by path. The default columns are:

  • maximum live-line churn in the file
  • median changed-line lifetime in days
  • median live-line age in days
  • repository path

With a path, git hot prints the reconstructed contents of that file. By default each line is preceded by its churn count.

Use --color always or --color never to control color output. Automatic coloring can rank lines by churn, age, or lifetime:

git hot --color always --color-domain age -- src/main.py

Formatting

Use --format to customize file or line output with a restricted Python f-string expression. The available fields depend on whether repository-wide file metrics or selected-path line output is being produced.

Examples:

git hot --format '{max(churn):5d} {days(median(line_age)):5d} {path}'
git hot --format '{days(age)} {hash[:7]} {line}' -- src/main.py

Common helpers include days, max, min, median, mean, quartile_rank, color, and color_reset.

For the complete list of format fields and options, see:

man git-hot

or read the git-hot manual page.

Requirements

git-hot expects to run inside a Git repository. Alternatively, the Git repository can be passed to the git command using the --git-dir option. Internally, it invokes Git commands such as git log, git show, and git diff, and uses rename and copy detection.

Binary files and deleted files are skipped in file-metric output.

Installing From Source

Building from source requires Python 3.10 or later and a Rust toolchain with rustc, because daglp is compiled during installation.

uv sync --group dev
uv pip install -e .
uv run python -m unittest discover -s . -p 'test*.py'
uv run --group dev ruff check .

Build a source distribution locally with:

uv build --sdist

Platform wheels are built in CI through cibuildwheel.

Research Tools

This repository also contains research-oriented source tools used for fine-grained code lifetime analysis, including lifetime.py, difflog.sh, tokenize.pl, and the top-level daglp.rs. They are kept in source form for reproducibility and experimentation, but the installable package exposes only git-hot and daglp.

For historical and research context, see lifetime-tools.md.

License

git-hot is distributed under the Apache License 2.0. See LICENSE.

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

git_hot-0.9.tar.gz (30.4 kB view details)

Uploaded Source

Built Distributions

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

git_hot-0.9-py3-none-win_amd64.whl (435.3 kB view details)

Uploaded Python 3Windows x86-64

git_hot-0.9-py3-none-manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

git_hot-0.9-py3-none-manylinux_2_28_aarch64.whl (995.4 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

git_hot-0.9-py3-none-macosx_11_0_arm64.whl (236.0 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file git_hot-0.9.tar.gz.

File metadata

  • Download URL: git_hot-0.9.tar.gz
  • Upload date:
  • Size: 30.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for git_hot-0.9.tar.gz
Algorithm Hash digest
SHA256 ae1e3d0432551e465ee454ed0c865f9aca830350122b759f60fc2b1597a54acf
MD5 940e6623cd7dde4f94dba1efa85f68c7
BLAKE2b-256 2f73bcaa0fdac73f48b641e2c90715735238b5dab12131c36a18f0a2dc517bb9

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_hot-0.9.tar.gz:

Publisher: ci.yml on dspinellis/git-hot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file git_hot-0.9-py3-none-win_amd64.whl.

File metadata

  • Download URL: git_hot-0.9-py3-none-win_amd64.whl
  • Upload date:
  • Size: 435.3 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for git_hot-0.9-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 08ea6e920001a5f11d8e90ef41532cc35116b483bb6a44e4e846619b331fc364
MD5 53501f0fb8fc12ac2522107652fe29c5
BLAKE2b-256 6bf9656cba72e28a9df84e5fd6c7faf0ef3fc86b909c3425fde0cf863e73bb83

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_hot-0.9-py3-none-win_amd64.whl:

Publisher: ci.yml on dspinellis/git-hot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file git_hot-0.9-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for git_hot-0.9-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 057779fe17006107f22c8a89a766738dc12112df8add18297baa802f15975111
MD5 be7462d81c939cc62ced572bb5cc5eca
BLAKE2b-256 09aff7d8fcefa279cc9cf6f05f3e776b57b75bbbb0fd6d5b890affad709a2600

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_hot-0.9-py3-none-manylinux_2_28_x86_64.whl:

Publisher: ci.yml on dspinellis/git-hot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file git_hot-0.9-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for git_hot-0.9-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 79e2325a7d5c1470b812d6db8622a5da9299abd5a59cc4a1b0eb9226bf4bf594
MD5 e8b35313f41a3978dfb5a9ffd957480b
BLAKE2b-256 bd56a767f1178bf38aa6f30451dd820f2dbab0bc39096d30daccc84554a0abcb

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_hot-0.9-py3-none-manylinux_2_28_aarch64.whl:

Publisher: ci.yml on dspinellis/git-hot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file git_hot-0.9-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: git_hot-0.9-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 236.0 kB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for git_hot-0.9-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b2b3d9a2f9371388bcaa0e99dd91a6b5a7932cf457bb43cd48f603cf3ecc32b
MD5 f92cf20b43e71494ecf4d6f95fba30c5
BLAKE2b-256 ffc28b9a7fa9c8d8f9e4a122b3f224bf133d4c4ef329b807b77bc87fe0496c18

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_hot-0.9-py3-none-macosx_11_0_arm64.whl:

Publisher: ci.yml on dspinellis/git-hot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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