Better support for large repositories and external diff tools
enhancement
First off, thanks for building such a fantastic tool!
I usually rely on **LazyGit**, but I've struggled to find a good way to visualize the commit graph in repositories with multiple developers. **Serie** has the cleanest and most readable commit graph visualization I've come across so far.
However, working with larger codebases brought up two specific challenges for me:
1. I wanted to check diffs using a richer UI than the standard `git diff` output, or open files directly in my editor for before/after comparison.
2. Even a single long-lived branch pushes the commit messages off-screen, making them unreadable.
I took a stab at solving these issues in a fork and wanted to share my findings with you.
- The interfaces and implementations below are just proof-of-concepts.
- The code was generated using Codex CLI (GPT-5.2-codex high).
If these features align with Serie's philosophy, I'd love to see them included :) (I'm happy to open a PR if you'd like.)
## 1. Add `mode = "exec"` option to temporarily run external commands and block until finished
I often use Neovim's [Diffview.nvim](https://github.com/sindrets/diffview.nvim) to check commit diffs. Since everyone has their preferred workflow, I thought it would be useful to allow users to view details directly in their familiar TUI or GUI.
### Configuration Example
```toml
[core.user_command]
commands_1 = { "name" = "git diff", commands = ["sh", "-c", "git diff --color=always {{first_parent_hash}} {{target_hash}} | delta --dark --paging=never --side-by-side --line-numbers --width {{area_width}}"] }
commands_2 = { "name" = "Diffview.nvim", commands = ["nvim", "-c", "DiffviewOpen \"{{first_parent_hash}}\"..\"{{target_hash}}\""], mode = "exec" }
[keybind]
user_command_view_toggle_2 = ["shift-d"]
```
### Result
https://github.com/user-attachments/assets/d8ae77d1-27c6-4e03-befa-107da15b7713
### Reference Commit
[https://github.com/tadashi-aikawa/serie/commit/c4e20e1d931468eee0e4bd89873f2071ce482f91](https://github.com/tadashi-aikawa/serie/commit/c4e20e1d931468eee0e4bd89873f2071ce482f91)
> [!NOTE]
> I realize Serie isn't trying to provide complex features beyond `git log --graph`, but since this is an extension of User Commands and simply builds an interface for external tools, I felt it might be within scope.
> [!NOTE]
> I'm not an expert in `Ratatui`, so I'm unsure about the validity of the code implementation...
## 2. Add CLI option to limit the number of commits displayed (`--max-commits <N>`)
Below is the result of displaying the commit graph for `stable-diffusion-webui` using Serie.
<img width="1772" height="1021" alt="Image" src="https://github.com/user-attachments/assets/d29f566d-0bd0-4ee8-8b87-a9a3e4d7e439" />
In many cases, I only need to check the most recent history (e.g., the last few dozen commits). If old, long-lived branches clutter the view and hide recent messages, simply limiting the commit count solves the problem.
### Command Example
```bash
serie --max-commits 100
```
### Result
<img width="1749" height="1014" alt="Image" src="https://github.com/user-attachments/assets/89f53ae1-cc7e-4518-aca3-5187277b5b30" />
### Reference Commit
[https://github.com/tadashi-aikawa/serie/commit/75d64358acc77150fc3e2a2606287bcf6af59908](https://github.com/tadashi-aikawa/serie/commit/75d64358acc77150fc3e2a2606287bcf6af59908)
---
# 🗾 `日本語バージョン`
はじめに、素晴らしいツールの開発をありがとうございます!
私はGit操作をするときはLazyGitを使っていますが、開発者が複数人のリポジトリでコミットグラフを把握する方法に頭を悩ませていました。Serieは私が今まで見てきたツールの中で、最もコミットグラフが見やすいと思います。
ただ、大きめのコードベースで確認するにあたり、2つの課題に直面しました。
1. git diffの出力よりもリッチなUIで確認したり、変更前後のファイルをエディタで開きたい
2. 生存期間が長いブランチが(たとえ1つでも)存在してしまうとコミットメッセージ以降がほぼ表示されない
forkしたリポジトリで、上記2つの課題を解決するPoCを試しにつくってみましたので、共有させてください。
- IFや実装は一例です
- コードはCodex CLI (GPT-5.2-codex high) で生成されたものです
もし、Serieの目指す方向に沿っているようでしたら、対応を検討いただけたら嬉しく思います。(PRが必要であれば作成いたします)
## 1. Serieから一時的に外部コマンドを実行し、完了までブロックするオプションを追加する (`mode = "exec"`)
私はNeovimの[Diffview.nvim](https://github.com/sindrets/diffview.nvim)でコミット差分を確認することが多いです。何で確認するかは人それぞれだと思いますが、馴染みのTUIやGUIでそのまま詳細が見られると便利だなと思い追加してみました。
### 具体的な設定イメージ
```toml
[core.user_command]
commands_1 = { "name" = "git diff", commands = ["sh", "-c", "git diff --color=always {{first_parent_hash}} {{target_hash}} | delta --dark --paging=never --side-by-side --line-numbers --width {{area_width}}"] }
commands_2 = { "name" = "Diffview.nvim", commands = ["nvim", "-c", "DiffviewOpen \"{{first_parent_hash}}\"..\"{{target_hash}}\""], mode = "exec" }
[keybind]
user_command_view_toggle_2 = ["shift-d"]
```
### 結果
https://github.com/user-attachments/assets/d8ae77d1-27c6-4e03-befa-107da15b7713
### 参考コミット
https://github.com/tadashi-aikawa/serie/commit/c4e20e1d931468eee0e4bd89873f2071ce482f91
> [!NOTE]
> Serieでは `git log --graph` を超える複雑な機能や操作の提供を目標としていないことは存じ上げておりますが、User Commandの延長上であり、外部ツールとのIFを構築するだけであれば許容範囲かなと感じました。
> [!NOTE]
> Ratatuiについて詳しくないので、コードの妥当性は分かっておりません...。
## 2. git logで表示する最大コミット数を制限するCLIオプションを追加する (`--max-commits <N>`)
以下は stable-diffusion-webui のコミットグラフをSerieで表示した結果です。
<img width="1772" height="1021" alt="Image" src="https://github.com/user-attachments/assets/d29f566d-0bd0-4ee8-8b87-a9a3e4d7e439" />
実際に確認したいコミットグラフは直近数十件だけのことが多く、何ヶ月・何年も前のブランチが常にそれらを阻害するのであれば、数を制限してしまえばいいと考えました。
### 具体的なコマンドイメージ
```
serie --max-commits 100
```
### 結果
<img width="1749" height="1014" alt="Image" src="https://github.com/user-attachments/assets/89f53ae1-cc7e-4518-aca3-5187277b5b30" />
### 参考コミット
https://github.com/tadashi-aikawa/serie/commit/75d64358acc77150fc3e2a2606287bcf6af59908
关闭于 2026-03-11 2 条评论