Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-commit-dag

Analyze which commits in a range can be safely reordered without conflicts.

Given a range of commits, git-commit-dag uses patch commutation to build a dependency DAG — showing which commits must come before which others, and which are independent.

Usage

git commit-dag <base>..<last> [--svg] [--context N] [--show-files] [--whole-file]
git commit-dag <base> <last>  [--svg] [--context N] [--show-files] [--whole-file]
git commit-dag --explain <commit1> <commit2> [--context N] [--whole-file]

The range follows standard git conventions: base is excluded, last is included (same as git log base..last).

Option Description
--explain Show conflicting hunks between two specific commits
--svg Output as SVG
--context N Expand hunks by N context lines (default 0; git apply uses 3)
--show-files Show which files cause each dependency
--whole-file Treat any two commits touching the same file as dependent

Example

$ git commit-dag HEAD~4 HEAD
○ d11afa9 A: modify line1 of file1
│ ○ cc006b8 C: modify file2
│ │
○ │ 03487f3 B: modify line1 of file1 again
├─┘
○   0a7d408 D: modify both files

411e44d E: update README  (independent)

Use --explain to see why two commits depend on each other:

$ git commit-dag --explain abc1234 def5678
abc1234 Fix login validation
def5678 Add rate limiting

auth.rs:
  [abc1234] @@ -42,1 +42,1 @@
  -old_check()
  +new_check()
  [def5678] @@ -43,0 +43,2 @@
  +rate_limit()
  +log_attempt()

Use --svg for graphical output:

git commit-dag HEAD~10 HEAD --svg > deps.svg

Building

cargo build --release
cp target/release/git-commit-dag ~/.local/bin/

Limitations

  • Textual analysis only — semantically dependent commits that touch different lines won't be detected.
  • Binary files, renames, and submodules are not analyzed.
  • Uses zero context lines by default, which is slightly more permissive than git apply. Use --context 3 to match git's default.

License

BSD-3-Clause. Patch commutation algorithm vendored from git-absorb.

About

git plugin to visualize a dependency tree between commits in a specified range

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages