Beautiful terminal UI for local git statistics - contribution heatmap, language breakdown, commit patterns
Project description
git-stats-tui
Beautiful terminal UI for local git statistics — contribution heatmap, language breakdown, commit patterns
About the author: I'm not a professional programmer — just someone who loves building useful tools with the help of AI (Vibe Coding). This project was created entirely through AI-assisted development. If you're also a beginner curious about coding, this repo is proof that you can ship real software too!
Features
- Contribution Heatmap — GitHub-style 52-week heatmap, right in your terminal
- Language Breakdown — file count by language with colored bar chart
- Commit Timeline — commit patterns by hour of day and day of week
- Top Contributors — author breakdown with share percentages
- Recent Commits — scrollable commit list with insertions/deletions
- Overview Dashboard — all key stats at a glance
- Date Range Filter — press
dto filter stats to a date range - Repo Switcher — press
sto switch to another repo without restarting - Keyboard Navigation — tab between views,
rto refresh,qto quit - Zero API Calls — pure local
.gitparsing, works offline, works with any git host
Quick Start
# Install
pip install git-stats-tui
# Run in any git repo
cd your-project
git-stats
# Or point to a specific repo
git-stats /path/to/repo
# Find all git repos under a directory
git-stats --find ~/projects
Screenshots
Key Bindings
| Key | Action |
|---|---|
Tab / Shift+Tab |
Switch between tabs |
r |
Refresh stats |
f |
Find repos under current directory |
d |
Toggle date range filter (e.g. 2025-01-01 ~ 2025-12-31) |
s |
Switch to another repo (path or #N for discovered repo) |
q |
Quit |
Tabs
| Tab | Content |
|---|---|
| Heatmap | 52-week contribution graph + current streak |
| Languages | File count by language with bar chart |
| Timeline | Commits by hour, by weekday, top authors |
| Commits | Recent commits with date, author, message, +/- lines |
| Overview | Summary: total commits, authors, branches, peak hour, weekend ratio |
How It Works
- Reads
git logwith--numstatfor commit history + file changes - Reads
git ls-filesfor language breakdown by file extension - Aggregates into daily/hourly/weekly/author buckets
- Renders with Textual TUI + Rich
No external API, no network, no token — pure local git.
Development
# Clone
git clone https://github.com/shadapang/git-stats-tui.git
cd git-stats-tui
# Install dev dependencies
pip install -e ".[dev]"
# Run
python -m src.app
# Lint
ruff check src/
License
MIT
git-stats-tui (中文说明)
在终端里看你的 Git 统计数据 —— 贡献热力图、语言占比、提交规律,一个命令搞定
关于作者:我不是专业程序员,只是一个喜欢用 AI 辅助做工具的爱好者(Vibe Coding)。这个项目完全由 AI 辅助开发完成。如果你也是编程小白,这个仓库就是证明——你也能做出真正能用的软件!
功能一览
- 贡献热力图 —— 和 GitHub 一样的 52 周热力图,直接在终端里显示
- 语言占比 —— 按文件类型统计,彩色柱状图展示
- 提交时间线 —— 按小时、按星期几统计提交规律
- 贡献者排行 —— 谁提交最多,占比多少
- 最近提交 —— 可滚动的提交列表,显示增删行数
- 总览仪表盘 —— 所有关键数据一目了然
- 日期范围筛选 —— 按
d键输入日期范围,只看某段时间的统计 - 仓库切换 —— 按
s键切换到另一个仓库,不用退出重启 - 键盘操作 —— Tab 切换页面,
r刷新,q退出 - 纯本地运行 —— 不调任何 API,不联网,不传数据,只读你本地的
.git目录
快速上手
前提条件
- Python 3.10 或以上
- 你的项目已经用 git 管理(有
.git目录)
安装和运行
# 第1步:安装依赖
pip install textual rich
# 第2步:下载项目
git clone https://github.com/shadapang/git-stats-tui.git
cd git-stats-tui
# 第3步:运行!
python -m src.app
指定仓库运行
# 看某个仓库的统计
python -m src.app /path/to/your/project
# 查找某个目录下所有 git 仓库
python -m src.app --find ~/projects
键盘快捷键
| 按键 | 功能 |
|---|---|
Tab / Shift+Tab |
切换页面 |
r |
刷新数据 |
f |
查找当前目录下的 git 仓库 |
d |
日期范围筛选(输入如 2025-01-01 ~ 2025-12-31) |
s |
切换到其他仓库(输入路径或 #1 选已发现的仓库) |
q |
退出 |
页面说明
| 页面 | 内容 |
|---|---|
| Heatmap(热力图) | 52 周贡献图 + 当前连续提交天数 |
| Languages(语言) | 按文件类型统计,柱状图展示 |
| Timeline(时间线) | 按小时、按星期几的提交分布 + 贡献者排行 |
| Commits(提交记录) | 最近的提交列表,含日期、作者、增删行数 |
| Overview(总览) | 汇总:总提交数、作者数、分支数、高峰时段、周末/工作日比 |
工作原理
全程不联网、不调 API、不需要 Token —— 只读你本地的 git 数据。
给编程小白的说明
如果你和我一样不是专业程序员,这里是一些可能有用的提示:
- 什么是终端/TUI? 就是那个黑底白字的命令行窗口。TUI = Text User Interface,在终端里画的界面。
- 什么是 git? 一个代码版本管理工具。如果你在 GitHub 上有项目,你本地就有
.git目录,这个工具就能读它。 - 怎么运行? 打开终端(Windows 按 Win+R 输入 cmd),按上面的"快速上手"步骤操作就行。
- 出错了怎么办? 确保你在 git 仓库目录下运行,或者用
python -m src.app /你的项目路径指定路径。
许可证
MIT(随便用,随便改,注明出处就行)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_stats_tui-0.3.0.tar.gz.
File metadata
- Download URL: git_stats_tui-0.3.0.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
116a2178b50e725061fbc8b42609d48a623f15f5d7ba3929522370d0e74fef4c
|
|
| MD5 |
85134b2305a092e33ab6a34a498c9bbc
|
|
| BLAKE2b-256 |
406bca69decf01424d101d91187386932e4453771ee51ffe903ab2aa95c2df03
|
Provenance
The following attestation bundles were made for git_stats_tui-0.3.0.tar.gz:
Publisher:
ci.yml on shadapang/git-stats-tui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_stats_tui-0.3.0.tar.gz -
Subject digest:
116a2178b50e725061fbc8b42609d48a623f15f5d7ba3929522370d0e74fef4c - Sigstore transparency entry: 1738927603
- Sigstore integration time:
-
Permalink:
shadapang/git-stats-tui@cbc21a800b33ce99bf94c0e4534d933b50f36001 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/shadapang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@cbc21a800b33ce99bf94c0e4534d933b50f36001 -
Trigger Event:
push
-
Statement type:
File details
Details for the file git_stats_tui-0.3.0-py3-none-any.whl.
File metadata
- Download URL: git_stats_tui-0.3.0-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e27d04dbab0f7703f135ad1e3253cc61db689791b0abe283a23ede8a755f1b5
|
|
| MD5 |
6ed8744af3e38c8c745c6461d2fede19
|
|
| BLAKE2b-256 |
a918d927595b3ebabd4d29a95dd38f79bd8589c1054557d4bd9f6468983b2549
|
Provenance
The following attestation bundles were made for git_stats_tui-0.3.0-py3-none-any.whl:
Publisher:
ci.yml on shadapang/git-stats-tui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_stats_tui-0.3.0-py3-none-any.whl -
Subject digest:
7e27d04dbab0f7703f135ad1e3253cc61db689791b0abe283a23ede8a755f1b5 - Sigstore transparency entry: 1738927611
- Sigstore integration time:
-
Permalink:
shadapang/git-stats-tui@cbc21a800b33ce99bf94c0e4534d933b50f36001 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/shadapang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@cbc21a800b33ce99bf94c0e4534d933b50f36001 -
Trigger Event:
push
-
Statement type: