Skip to content

git: Add graph support - #44434

Merged
Anthony-Eid merged 116 commits into
mainfrom
git-graph
Jan 23, 2026
Merged

git: Add graph support#44434
Anthony-Eid merged 116 commits into
mainfrom
git-graph

Conversation

@Anthony-Eid

@Anthony-Eid Anthony-Eid commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Closes #26866

Summary

Adds a git graph to Zed, accessible via the git_graph::Open action if a project has an active repository. There's still more to do, but this is a solid foundation to expand upon. The code structure is in line with Zed's codebase and shouldn't require architectural changes to add missing features.

The git graph can be opened via the command palette (git graph: open) or by binding a key to git_graph::Open. It's available when the project has an active git repository.

Architecture

Similar to the Debugger, the git graph is split between a data layer and a view/UI layer. When the view layer is rendering, it queries the data layer for its active state. This setup allows the data layer to lazily request graph data (only when needed for rendering), abstracts collab from the view layer, allows most of the data loading to happen on a background thread, and makes caching easy to implement.

Graph Loading

The graph data is loaded in two phases:

  1. Repository::graph_data() streams commit structure (SHA, parents, refs) in chunks of 1000 via git log
  2. CommitDataReader lazily fetches full commit details (author, timestamp, subject) on-demand using a persistent git cat-file --batch process

This two-phase approach makes the initial loading of the graph as fast as possible, because git log takes significantly longer when all the needed graph data is queried through it. Zed then lazily loads commits in the user's viewport through cat-file --batch. This makes scrolling to any place in the graph extremely snappy and benefits the collaborative architecture by only fetching data needed to render the graph. It also allows Zed to share commit data between different graph visualizations (e.g., date order vs. topological order).

Performance

Tested on both the Zed and LLVM repositories with good performance in both cases. The two-phase loading approach and lazy fetching keep the UI responsive even with large commit histories.

Testing

I added property testing that builds randomized commit graphs and verifies that the graph is constructed correctly. This also works as an integration test and will be expanded in the future to test collab graph visualization, graph filtering, commit actions, etc.

New Crate

  • git_graph (GPL-licensed) — contains UI and graph computation logic

Not Yet Implemented

  • Remote repository support (collab)
  • Filtering by branch
  • Commit actions (checkout, cherry-pick, etc.)
  • Search
  • Open commit view for selected commit
  • Resizable columns
  • Column filtering

Reference

Screenshot 2025-01-22 at 8 15 39 PM

Special thanks to Alberto Slavica for submitting #44405, which was a good base to work off of.

Release Notes:

  • git: Add initial version of git graph

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Dec 8, 2025
#44405

Co-authored-by: pyundev <pyundev@users.noreply.github.com>
@alphathekiwi

alphathekiwi commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

For those who are following this PR and saw that it was taking the UI from #44405
Here is a screenshot of what the graph looks like in that source commit in its current state
image

I have run this branch it currently looks like this, lots of great improvements already
image

@alphathekiwi

Copy link
Copy Markdown
Contributor

Would love to see this handy little overlay replacing the current hover title

image

This could also be added later

@RohanAsokan-Perceptyne

Copy link
Copy Markdown

@jlokos I am on latest main and built from source and git_graph is still not in the command palette

Zed Dev 0.226.0
40d3aa6

0.226.0+dev.40d3aa6fea08f8f27449e290f3e390f69b07de99

Am I missing something?

@ojpro

ojpro commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

is there any updates on this, when it will be available?

@Anthony-Eid

Copy link
Copy Markdown
Contributor Author

is there any updates on this, when it will be available?

At the current rate of progress 2-3 weeks (In preview) if I had to guess. @RemcoSmitsDev has started working with me on adding the last features and our pre launch todo list is almost done! The last big thing I want to do implement search, but I haven't fully figured out the most efficient way to do so yet.

I also need to get ok that the UI is polish enough from the team and designer

@mainmachine

Copy link
Copy Markdown

As another would-be migrant from VSCode, this is an essential feature for me. All of the coding features are excellent already, however the "review" context features are still a bit lean. Git history, merge tools, that kind of thing are critical to me so I don't relapse! XD

@nelwincatalogo

Copy link
Copy Markdown

We don't need this to be perfect initially.. just make it exist.. enhancement will follow as the user provide feedback

@xgfone

xgfone commented Mar 4, 2026

Copy link
Copy Markdown

We don't need this to be perfect initially.. just make it exist.. enhancement will follow as the user provide feedback

Yes, for me, as long as it works, that's all that matters. Optimization or enhancement can be handled gradually later on.

@MrPiada

MrPiada commented Mar 13, 2026

Copy link
Copy Markdown

Any news on this? It's the feature that's preventing me from switching from vscode to zed.

@bobbymannino

bobbymannino commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Any news on this? It's the feature that's preventing me from switching from vscode to zed.

The main body of work was merged a few days ago but the Zed team want to up the standards to it before releasing it in public, it is ready on the main branch though so if you want a preview you can look there. They estimated it will take another couple weeks to preview but this is not a hard deadline

@alphathekiwi

alphathekiwi commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Completed (Merged)

Date PR Title Authors
Mar 10 #50956 Add select first & last actions @RemcoSmitsDev
Feb 25 #50123 Polish UX (error message propagation started, repo name in tab) @Anthony-Eid
Feb 25 #50027 Improve connection between graph and commit views @danilo-leal
Feb 23 #49910 Add button to open commit view (mouse-based discoverability) @danilo-leal
Feb 23 #49899 Design adjustments @danilo-leal
Feb 23 #49876 Improve commit detail panel UI (icons, copy sha) @Anthony-Eid
Feb 23 #49836 Allow cancelling active selection via keyboard @RemcoSmitsDev
Feb 21 #49736 Improve loading time @RemcoSmitsDev
Feb 16 #49171 Resizable commit view support (sidebar width persistence) @RemcoSmitsDev
Feb 12 #49051 Basic keyboard navigation @RemcoSmitsDev
Feb 12 #48842 Open commit list from Git panel / commit diff from Graph rows @cppcoffee
Jan 23 #47514 Add loading icon instead of no commits message @Anthony-Eid
Jan 23 #47486 Fix subject not wrapping (partial clipping fix) @marcocondrache
Jan 23 #47485 Add resizable columns @marcocondrache
Jan 23 #47453 Fix slow initial loading times @Anthony-Eid

In Progress (Open PRs)

PR Title Authors
#50703 Make git graph canvas column resizable @feeiyu
#50123 Error message propagation (started, not complete) @Anthony-Eid

Not Started (No PR found)

Item Assignee
Graph header wrapping / doubling height @remco @anthony
Graph lines not straight on same x-axis as merged node @anthony
Graph invalidates cache when new commit added (needs tests) unassigned
"View on GitHub" shouldn't show if commit not on remote branch unassigned
Flickering values/avatar when clicking between commits unassigned
Author icon not loading (rate limit, email-based lookup, caching) unassigned
Show error message if graph fails to load (design needed) unassigned
Make commit nodes white/black based on theme unassigned
Gray lines connecting commits to branch ref id (Figma design exists) unassigned
Show horizontal scrollbar in graph canvas unassigned
Fix clipping (text/bullet) at edges of column unassigned
Horizontal scroll broken when commit sidebar open unassigned

I got AI to do a prediction based on progress made

Velocity Estimate

  • 15 PRs merged over ~46 days (Jan 23 → Mar 10)
  • ~2.3 PRs/week average
  • 12 items remain with no PR
  • At current velocity: hopefully ~5 weeks to clear the backlog
  • Assuming roughly 5 weeks we might have git graph late April / early May 2026

@Anthony-Eid

Copy link
Copy Markdown
Contributor Author

The todo list is somewhat out of date. I have a PR for search implementation, and started working on polishing the graph rendering.

After that is done, the initial version of the graph will be released. In other words the channel notes are out of date in our favor 😀

@xgfone

xgfone commented Mar 26, 2026

Copy link
Copy Markdown

The todo list is somewhat out of date. I have a PR for search implementation, and started working on polishing the graph rendering.

After that is done, the initial version of the graph will be released. In other words the channel notes are out of date in our favor 😀

I'm happy to see the feature in the next preview version😀

@alphathekiwi

alphathekiwi commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Wow thats amazing news, very excited to see this landing.
#51886 - search looks to have merged 🎉

working on polishing the graph rendering

Is that this PR? Or are there quite a few areas that need improvement
#52580

@Anthony-Eid

Copy link
Copy Markdown
Contributor Author

Wow thats amazing news, very excited to see this landing. #51886 - search looks to have merged 🎉

working on polishing the graph rendering

Is that this PR? Or are there quite a few areas that need improvement #52580

That's one of the two PRs I want to have to clean up the graph rendering. However, I'm really pushing for a Wednesday release so we'll see what ends up getting in by that point. The graph is at a great state right now, and I don't have much free time to keep polishing this for the near future so I'm hoping to get version 1.0 shipped.

@Samuelodan

Samuelodan commented Mar 30, 2026

Copy link
Copy Markdown

Ayy! Wednesday would be amazing if you manage to hit your target. Thanks for all your hard work, and I wanna say I like this approach of getting an initial, stable version out with refinements added as they come over time.

Edit: typo.

@syncdoth

syncdoth commented Apr 2, 2026

Copy link
Copy Markdown

Sadly, not included in today's pre-release :(

@Anthony-Eid

Copy link
Copy Markdown
Contributor Author

Sadly, not included in today's pre-release :(

We're going to cherry pick it in, most likely tomorrow. I need to fix some of the resize behavior on the graph (which I'm working on right now), then remove the feature flag.

@Samuelodan

Copy link
Copy Markdown

Oh wow! This is so interesting. I wish to be flung back to when software updates could only come in the next physical release; and just stay there for a little while so I can better appreciate all this goodness.

Anyway, is it easy to switch from the stable to the prerelease and back? I haven't really looked into it yet.

@Anthony-Eid

Copy link
Copy Markdown
Contributor Author

Oh wow! This is so interesting. I wish to be flung back to when software updates could only come in the next physical release; and just stay there for a little while so I can better appreciate all this goodness.

Typically we want to avoid cherry picks like this, but we really want to get this out sooner rather than later. This PR: #52953 ended up taking a lot longer to finish than expected. Once it's merged I'll make a small PR to remove the feature flag and it will be released shortly after.

Anyway, is it easy to switch from the stable to the prerelease and back? I haven't really looked into it yet.

https://zed.dev/download/preview You can download our preview version from our website, and just use that app until you want to switch back to stable.

@Samuelodan

Copy link
Copy Markdown

Typically we want to avoid cherry picks like this, but we really want to get this out sooner rather than later.

I feel you.

Once it's merged I'll make a small PR to remove the feature flag and it will be released shortly after.

Nice. Thank you for your work.

You can download our preview version from our website, and just use that app until you want to switch back to stable.

Okay, I'm assuming all my settings would sync and that should be all I'd need to comfortably use the preview until I'm ready to switch again.

Alright. Thanks again.

@Anthony-Eid

Copy link
Copy Markdown
Contributor Author

Btw it’s live on preview 😀

@Samuelodan

Copy link
Copy Markdown

Yes it is!! Thank you, Anthony 😊.
I made an announcement post on Reddit 8 hours ago, cos that's when I found the time to check it out, and I must say, it looks really good.

I'm excited for what the feature will evolve into in the future.

@alecuba16

alecuba16 commented Apr 3, 2026

Copy link
Copy Markdown

Is it planned to implement: ?

  • Compare commit # to local
  • Reset soft/hard to a specific commit #

If no, and someone does, it would be well received or there is no plan for that?

Just wondering to do it myself or not (one of those).

@jakeleventhal

Copy link
Copy Markdown

Nice work Zed team and all contributers!

I made 3 follow up discussions for remaining gaps in functionality:

  1. Visual improvement to checked out branch in git graph feature #53108
  2. Double click on branch to check it out on Git graph #53111
  3. Add interactivity and context menus to git graph feature #53112

@alextsagkas

Copy link
Copy Markdown

Is there a plan to support git graph in remote development environments?

@Anthony-Eid

Copy link
Copy Markdown
Contributor Author

Is there a plan to support git graph in remote development environments?

Yes

@necauqua necauqua mentioned this pull request Apr 29, 2026
1 task
@syncdoth

Copy link
Copy Markdown

In case anyone is interested...

https://github.com/syncdoth/zed/tree/git-graph-vscode-controls

I really loooove VS code's git graph plugin. I wanted zed's git graph to have similar features. Namely:

  1. branch filtering: option to show only local/remote branches (and tags), or search for branches and show selected branches only.
  2. double-click branch name to checkout the branch.
  3. (minor) click the commit row again to close the changes panel on the right.

I customized it under my fork for my self-use. It served me well for the past week!

Disclaimer: I am not a rust dev so this is entirely AI-developed. Use this at your own risk. I didn't open a PR to not impose burden on the maintainers with un-tested (potentially slop 😜) code.

jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
Closes zed-industries#26866

### Summary
Adds a git graph to Zed, accessible via the `git_graph::Open` action if
a project has an active repository. There's still more to do, but this
is a solid foundation to expand upon. The code structure is in line with
Zed's codebase and shouldn't require architectural changes to add
missing features.

The git graph can be opened via the command palette (`git graph: open`)
or by binding a key to `git_graph::Open`. It's available when the
project has an active git repository.

### Architecture

Similar to the Debugger, the git graph is split between a data layer and
a view/UI layer. When the view layer is rendering, it queries the data
layer for its active state. This setup allows the data layer to lazily
request graph data (only when needed for rendering), abstracts collab
from the view layer, allows most of the data loading to happen on a
background thread, and makes caching easy to implement.

#### Graph Loading

The graph data is loaded in two phases:
1. `Repository::graph_data()` streams commit structure (SHA, parents,
refs) in chunks of 1000 via `git log`
2. `CommitDataReader` lazily fetches full commit details (author,
timestamp, subject) on-demand using a persistent `git cat-file --batch`
process

This two-phase approach makes the initial loading of the graph as fast
as possible, because `git log` takes significantly longer when all the
needed graph data is queried through it. Zed then lazily loads commits
in the user's viewport through `cat-file --batch`. This makes scrolling
to any place in the graph extremely snappy and benefits the
collaborative architecture by only fetching data needed to render the
graph. It also allows Zed to share commit data between different graph
visualizations (e.g., date order vs. topological order).

#### Performance

Tested on both the Zed and LLVM repositories with good performance in
both cases. The two-phase loading approach and lazy fetching keep the UI
responsive even with large commit histories.

#### Testing 

I added property testing that builds randomized commit graphs and
verifies that the graph is constructed correctly. This also works as an
integration test and will be expanded in the future to test collab graph
visualization, graph filtering, commit actions, etc.

### New Crate
- `git_graph` (GPL-licensed) — contains UI and graph computation logic

### Not Yet Implemented
- Remote repository support (collab)
- Filtering by branch
- Commit actions (checkout, cherry-pick, etc.)
- Search
- Open commit view for selected commit
- Resizable columns 
- Column filtering

#### Reference
<img width="1624" height="976" alt="Screenshot 2025-01-22 at 8 15 39 PM"
src="https://github.com/user-attachments/assets/0f10924a-3964-462f-b320-42d84d02f7bf"
/>

Special thanks to [Alberto Slavica](https://github.com/pyundev) for
submitting zed-industries#44405, which was a good base to work off of.

Release Notes:

- git: Add initial version of git graph

---------

Co-authored-by: pyundev <pyundev@users.noreply.github.com>
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Closes zed-industries#26866

### Summary
Adds a git graph to Zed, accessible via the `git_graph::Open` action if
a project has an active repository. There's still more to do, but this
is a solid foundation to expand upon. The code structure is in line with
Zed's codebase and shouldn't require architectural changes to add
missing features.

The git graph can be opened via the command palette (`git graph: open`)
or by binding a key to `git_graph::Open`. It's available when the
project has an active git repository.

### Architecture

Similar to the Debugger, the git graph is split between a data layer and
a view/UI layer. When the view layer is rendering, it queries the data
layer for its active state. This setup allows the data layer to lazily
request graph data (only when needed for rendering), abstracts collab
from the view layer, allows most of the data loading to happen on a
background thread, and makes caching easy to implement.

#### Graph Loading

The graph data is loaded in two phases:
1. `Repository::graph_data()` streams commit structure (SHA, parents,
refs) in chunks of 1000 via `git log`
2. `CommitDataReader` lazily fetches full commit details (author,
timestamp, subject) on-demand using a persistent `git cat-file --batch`
process

This two-phase approach makes the initial loading of the graph as fast
as possible, because `git log` takes significantly longer when all the
needed graph data is queried through it. Zed then lazily loads commits
in the user's viewport through `cat-file --batch`. This makes scrolling
to any place in the graph extremely snappy and benefits the
collaborative architecture by only fetching data needed to render the
graph. It also allows Zed to share commit data between different graph
visualizations (e.g., date order vs. topological order).

#### Performance

Tested on both the Zed and LLVM repositories with good performance in
both cases. The two-phase loading approach and lazy fetching keep the UI
responsive even with large commit histories.

#### Testing 

I added property testing that builds randomized commit graphs and
verifies that the graph is constructed correctly. This also works as an
integration test and will be expanded in the future to test collab graph
visualization, graph filtering, commit actions, etc.

### New Crate
- `git_graph` (GPL-licensed) — contains UI and graph computation logic

### Not Yet Implemented
- Remote repository support (collab)
- Filtering by branch
- Commit actions (checkout, cherry-pick, etc.)
- Search
- Open commit view for selected commit
- Resizable columns 
- Column filtering

#### Reference
<img width="1624" height="976" alt="Screenshot 2025-01-22 at 8 15 39 PM"
src="https://github.com/user-attachments/assets/0f10924a-3964-462f-b320-42d84d02f7bf"
/>

Special thanks to [Alberto Slavica](https://github.com/pyundev) for
submitting zed-industries#44405, which was a good base to work off of.

Release Notes:

- git: Add initial version of git graph

---------

Co-authored-by: pyundev <pyundev@users.noreply.github.com>
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
paterschris added a commit to paterschris/lathe that referenced this pull request Aug 17, 2026
Rank features by how much each one distinguishes Lathe from stock Zed
rather than by day-to-day use. Mobile development moves from 6 to 1 and
the git section from 1 to 6.

Correct several entries that described upstream Zed features as fork
features. The commit graph (upstream zed-industries#44434, January 2026), the tabbed
git panel, and worktree support all predate the fork, so the git section
is now scoped to what Lathe layers on top of them. Drop the terminal
bell entry entirely: TerminalBell is identical to upstream's System/Off
enum and carries no sound selection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.