git_graph: Add branch filter, push dialog, commit context menu, and graph settings - #53316
Conversation
Add a gear menu next to the search bar for toggling graph display options. Wire the selected settings into git log loading so stashes, tags, reflog-only commits, and first-parent traversal affect the rendered graph instead of only the UI state.
…, drop, merge, rebase, reset) and stash management
…delete branch operations
…with leading icons and weight
- Add BranchFilterState with picker for filtering commits by branch - Add LogSource::Branches variant for multi-branch filtering - Implement branch selection logic with show/hide remote branches support - Add comprehensive tests for branch filtering functionality
- Refactor PushOptions from simple enum to struct with set_upstream flag and PushMode - Add PushMode enum with Normal, ForceWithLease, and Force variants - Add PushBranchModal with UI for selecting remote, set upstream, and push mode - Update protobuf Push message to match new PushOptions structure - Add tests for push dialog state and default remote selection
…it-graph-enhancements
…eset in fake git Add missing force_delete field to the GitDeleteBranch proto message and wire it through the handler. Also add ResetMode::Hard handling to FakeGitRepository::reset.
|
This PR is too large for me to review in a reasonable amount of time. Could you please split this up in several smaller PRs where each PR == 1 feature? |
I appreciate the feedback. I'll split these changes into smaller, more manageable PRs soon to make the review process easier for you. Thanks for checking it out! |
|
Hi @Anthony-Eid , Thank you for the feedback! I've split the original PR into 8 smaller, focused PRs as requested. Each PR contains exactly 1 feature for easier review: Split PRs
Please review them at your convenience! |
|
@nguyenphutrong I'm going to need a week or two until I can start adding git graph features, we're in the middle of an important launch and I want to finish remote git graph support before moving on to anything else |
|
Thanks for the update, @Anthony-Eid! Quick thought: I wanted to bring up #53403 - "Allow Extensions to Render GUI". If we had that, I (or other developers) could build Git Graph as an extension instead of being built-in to Zed. This would accelerate Git Graph development specifically, and more importantly, grow Zed's ecosystem overall. Compared to VSCode, Cursor, or JetBrains IDEs, Zed's extension ecosystem is still quite limited (I listed some use cases in that discussion). Enabling UI rendering in extensions would be a game-changer for bringing more developers to build on Zed. Would love to hear your thoughts on this direction! |
This is something we eventually want to do, but I can't say when it will be on our roadmap because we have a lot of other things in development right now. Plus, it's a big task to complete because we would have to expose GPUI APIs, which means we need to keep GPUI backwards compatible. Which is difficult with how often we change GPUI right now. |
|
Understood, thanks for explaining! Look forward to seeing this on the roadmap eventually. |
@Anthony-Eid, is this accurate that the core team is going to implement what was attempted here?
Thanks. |
|
This is absolutely genius; it would turn Zed into a full-fledged Git client. Why is this closed? Too large for the Zed team to review? |
|
This would be so useful! Could finally migrate from vscode to zed completely if this is implemented. |
|
Hi @Anthony-Eid, quick question to make sure I do not duplicate work. I noticed #55720 was merged, and it looks like the team is starting to add more Git Graph functionality internally. Since you previously asked me to split #53316 into smaller PRs, should I still continue opening small, one-feature PRs for the remaining Git Graph features, or is the Zed team planning to implement these features yourselves? If the team already has an internal direction or tracking issue for Git Graph improvements, I’m happy to pause my follow-up PRs and avoid creating review noise. Just want to align before I continue. Thanks! |
|
@nguyenphutrong Do you have discord? We should talk over there because any help would be appreciated Also, I'm sorry for how long it's taken me to get back to you and review your PR. I don't have much bandwidth these days and have been trying to get others to take over the easy parts of the graph code base If you could make a PR expanding our right click context menu that would be a great first step btw! |
|
Here is my Discord https://discord.com/users/820488821162115103 or username: |
|
@nguyenphutrong - thats my fault. I jumped onto add a context menu without knowing there were any PRs that might've been attempting to do the same. I should've looked through them and found out. Sorry about that. |
|
I created a new PR here: #55844 It is still fairly large (+6,063 / -1,705), but it is focused on the first step you suggested: expanding the graph right-click context menu. It adds the context menu flow for commits, branches, tags, and stashes, so I would appreciate it if @Anthony-Eid and @JosephTLyons could take a first look and let me know whether this direction works for the graph codebase. Also, yes, I’m happy to discuss on Discord if that is easier. Thanks again for taking the time to review this despite the limited bandwidth. |
Self-Review Checklist:
Summary
This PR enhances the Git Graph panel with comprehensive new features for branch management, commit operations, and graph visualization options. It introduces interactive dialogs for pushing branches with force options, filtering commits by branch, and performing various git operations directly from the commit graph.
Features Added
1. Branch Filter with Picker
2. Push Branch Dialog
--set-upstreamflag for setting upstream tracking--force-with-leaseand--force3. Commit Context Menu Operations
Added comprehensive right-click context menu on commits with the following operations:
-xoption support and merge commit handling4. Graph Settings Dropdown
Added settings panel to control graph visualization:
--reflog)--first-parent)Technical Details
New Types Added
New Git Operations
create_branch_at- Create branch at specific SHAcreate_tag- Create annotated tags with messagescheckout_commit- Detached HEAD checkoutcherry_pick- With merge commit detection and-m 1handlingrevert_commit- With no-commit optiondrop_commit/drop_commit_support- With safety preflight checksmerge_commit- Fast-forward mergerebase_onto- Rebase operationdelete_tag/push_tag- Tag managementdelete_branchwithforce_deleteparameterFiles Changed
crates/git_graph/src/git_graph.rs- Main UI implementation with pickers, dialogs, and context menucrates/git/src/repository.rs- New git operations and types (PushOptions, GraphLogOptions, etc.)crates/project/src/git_store.rs- Repository state management and job handlingcrates/fs/src/fake_git_repo.rs- Fake git implementation for testingcrates/proto/proto/git.proto- Protocol messages for collab supportcrates/git_ui/src/branch_picker.rs- Branch picker integrationcrates/git_ui/src/git_panel.rs- Git panel integrationcrates/ui/src/components/chip.rs- Chip component styling for branch tagscrates/icons/src/icons.rs- New icons for stash and tagTesting
Backward Compatibility
Closes #53112 #53108 #53112
Release Notes: