Skip to content

git_graph: Add context menu operations - #55844

Closed
nguyenphutrong wants to merge 18 commits into
zed-industries:mainfrom
nguyenphutrong:feature/git-graph-context-menu
Closed

git_graph: Add context menu operations#55844
nguyenphutrong wants to merge 18 commits into
zed-industries:mainfrom
nguyenphutrong:feature/git-graph-context-menu

Conversation

@nguyenphutrong

@nguyenphutrong nguyenphutrong commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add Git Graph context menus for commit rows and branch/tag/stash chips.
  • Add operation dialogs and backend API support for push, checkout, branch creation, cherry-pick, revert, reset, merge, rebase, and stash/ref actions.
  • Improve context menu responsiveness and prevent Git Graph scrolling while a context menu is open.
Screenshot 2026-05-06 at 11 00 27@2x Screenshot 2026-05-06 at 11 01 03@2x Screenshot 2026-05-06 at 11 01 20@2x Screenshot 2026-05-06 at 11 01 32@2x

Tests

  • cargo fmt --all
  • cargo test -p git_graph
  • cargo check -p git_graph
  • cargo check -p project
  • git diff --check

Suggested .rules additions

  • In git_graph, context-menu scroll blocking needs to cover both graph canvas handlers and table uniform_list().track_scroll(...); blocking only handle_graph_scroll does not stop table wheel events.

Release Notes:

  • Improved Git Graph context menu operations and responsiveness.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 6, 2026
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label May 6, 2026
@nguyenphutrong
nguyenphutrong marked this pull request as ready for review May 6, 2026 09:16
@MrSubidubi MrSubidubi changed the title Git Graph: Add context menu operations git_graph: Add context menu operations May 6, 2026
@MrSubidubi

Copy link
Copy Markdown
Member

I see this was discussed in the original PR already, but I heavily suspect this would be easier for @Anthony-Eid to review and get merged if this was split into smaller chunks, as this will get conflicts quickly. Will leave the final verdict to him but wanted to mention it already nonetheless

@ChristopherBiscardi ChristopherBiscardi added the area:integrations/git/git graph Feedback for Zed's git graph support label May 6, 2026
# Conflicts:
#	crates/fs/src/fake_git_repo.rs
#	crates/git/src/repository.rs
#	crates/git_ui/src/branch_picker.rs
#	crates/project/src/git_store.rs
#	crates/proto/proto/git.proto
@nguyenphutrong
nguyenphutrong marked this pull request as draft May 7, 2026 02:12
@nguyenphutrong
nguyenphutrong marked this pull request as ready for review May 7, 2026 02:33
@nguyenphutrong

Copy link
Copy Markdown
Contributor Author

Hi @JosephTLyons, could you please take a look at this PR when you have a chance?

It looks like #56110 and #56354 were developed in parallel with this PR, so there are now quite a few conflicts between the branches. Some of the original context/discussion is also in #53316.

If possible, could you review this PR and, if it makes sense, pull these changes into your branch and make the necessary adjustments there? Since your newer PRs already touch the conflicting areas, I think that would be the safest way to resolve this without accidentally dropping behavior from either side.

Thanks.

@JosephTLyons

Copy link
Copy Markdown
Collaborator

Hey @nguyenphutrong

Sorry it's taken me so long to get back to you.

I decided not to merge your changes into my custom git commands branch because this PR is quite large, and ultimately it would've required a second person at Zed to review my branch alongside all of these changes.

I think this PR still needs to be broken up into multiple PRs, with each one scoped to a single fix or enhancement. I also think each item should be discussed beforehand so we can make sure the team is on board (with the feature in general, and with the implementation) before we add it.

Since all of these features touch the same area of the code, it's probably best to avoid opening multiple PRs here at once — otherwise your own PRs will likely conflict with each other as they get squash-merged into main.

As a first step, I'd be happy to review a PR scoped to just your fix for not scrolling the git graph while the context menu is open, and we can go from there. I think for that fix should be applied centrally. Any list that scrolls and has entries that have context menus, should be blocked from scrolling when the context menu is open.

@serajhqi

Copy link
Copy Markdown

@nguyenphutrong I’m eagerly waiting for these awesome changes.

pull Bot pushed a commit to tangzixuan/zed that referenced this pull request Jun 9, 2026
…ries#58781)

Right-clicking a ref label (branch, remote ref, or tag) in the git graph
now opens a ref-specific context menu that resolves custom git commands
with the clicked ref exposed as ZED_GIT_REF, mirroring how VS Code's git
graph offers ref-aware actions. Right-clicking elsewhere on a commit
keeps the existing commit-scoped menu.

<img width="875" height="525" alt="zed (Ubuntu) 2026_06_07 23_26_35"
src="https://github.com/user-attachments/assets/140bdcdf-6536-4b5e-ac2f-9df84f744477"
/>


releated: zed-industries#55844 zed-industries#56354


Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Added a context menu for ref labels in the git graph that runs custom
git commands with the clicked ref available as `$ZED_GIT_REF`.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
…ries#58781)

Right-clicking a ref label (branch, remote ref, or tag) in the git graph
now opens a ref-specific context menu that resolves custom git commands
with the clicked ref exposed as ZED_GIT_REF, mirroring how VS Code's git
graph offers ref-aware actions. Right-clicking elsewhere on a commit
keeps the existing commit-scoped menu.

<img width="875" height="525" alt="zed (Ubuntu) 2026_06_07 23_26_35"
src="https://github.com/user-attachments/assets/140bdcdf-6536-4b5e-ac2f-9df84f744477"
/>


releated: zed-industries#55844 zed-industries#56354


Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Added a context menu for ref labels in the git graph that runs custom
git commands with the clicked ref available as `$ZED_GIT_REF`.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…ries#58781)

Right-clicking a ref label (branch, remote ref, or tag) in the git graph
now opens a ref-specific context menu that resolves custom git commands
with the clicked ref exposed as ZED_GIT_REF, mirroring how VS Code's git
graph offers ref-aware actions. Right-clicking elsewhere on a commit
keeps the existing commit-scoped menu.

<img width="875" height="525" alt="zed (Ubuntu) 2026_06_07 23_26_35"
src="https://github.com/user-attachments/assets/140bdcdf-6536-4b5e-ac2f-9df84f744477"
/>


releated: zed-industries#55844 zed-industries#56354


Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Added a context menu for ref labels in the git graph that runs custom
git commands with the clicked ref available as `$ZED_GIT_REF`.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:integrations/git/git graph Feedback for Zed's git graph support cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants