git: Add graph support - #44434
Conversation
#44405 Co-authored-by: pyundev <pyundev@users.noreply.github.com>
001eeab to
84b787f
Compare
|
For those who are following this PR and saw that it was taking the UI from #44405 I have run this branch it currently looks like this, lots of great improvements already |
|
Would love to see this handy little overlay replacing the current hover title
This could also be added later |
Co-authored-by: pyundev <pyundev@users.noreply.github.com>
Co-authored-by: Cole Miller <cole@zed.dev>
|
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 |
|
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 |
|
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. |
|
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 |
Completed (Merged)
In Progress (Open PRs)
Not Started (No PR found)
I got AI to do a prediction based on progress madeVelocity Estimate
|
|
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😀 |
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. |
|
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. |
|
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. |
|
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. |
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.
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. |
I feel you.
Nice. Thank you for your work.
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. |
|
Btw it’s live on preview 😀 |
|
Yes it is!! Thank you, Anthony 😊. I'm excited for what the feature will evolve into in the future. |
|
Is it planned to implement: ?
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). |
|
Nice work Zed team and all contributers! I made 3 follow up discussions for remaining gaps in functionality: |
|
Is there a plan to support git graph in remote development environments? |
Yes |
|
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:
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. |
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>
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>
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.



Closes #26866
Summary
Adds a git graph to Zed, accessible via the
git_graph::Openaction 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 togit_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:
Repository::graph_data()streams commit structure (SHA, parents, refs) in chunks of 1000 viagit logCommitDataReaderlazily fetches full commit details (author, timestamp, subject) on-demand using a persistentgit cat-file --batchprocessThis two-phase approach makes the initial loading of the graph as fast as possible, because
git logtakes significantly longer when all the needed graph data is queried through it. Zed then lazily loads commits in the user's viewport throughcat-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 logicNot Yet Implemented
Reference
Special thanks to Alberto Slavica for submitting #44405, which was a good base to work off of.
Release Notes: