Skip to content

git_ui: Add Shift-click multi-select to the Git Panel - #63444

Open
peakxy wants to merge 5 commits into
zed-industries:mainfrom
peakxy:git-panel-shift-multi-select
Open

git_ui: Add Shift-click multi-select to the Git Panel#63444
peakxy wants to merge 5 commits into
zed-industries:mainfrom
peakxy:git-panel-shift-multi-select

Conversation

@peakxy

@peakxy peakxy commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Objective

Solution

  • Shift-clicking a file marks all visible entries between the anchor and the clicked entry (marked_entries), in both flat and tree view modes; a plain click collapses back to a single selection, and clicking the empty area below the list clears the selection.
  • A selected_status_entries() helper resolves the marked entries when present, otherwise the single selected entry, and all entry actions now operate on that list:
    • Stage/Unstage: entries are partitioned by their current stage status and staged/unstaged in one batch.
    • Discard/Restore/Trash: one confirmation prompt (“N files”) followed by a per-entry revert.
    • Open File Diff, View File, View File History, Add to .gitignore / .git/info/exclude: operate on each marked entry.
    • Copy Path, Copy Relative Path, and Open Diff intentionally keep their single-entry behavior.
  • Right-clicking an unmarked entry collapses the multi-selection to that entry; right-clicking a marked entry keeps the group and shows plural menu titles (“Stage Files”, “Trash Files”, …).
  • Multi-selection marks survive list rebuilds (view mode switch, status refresh) by re-resolving the marked paths after update_visible_entries.

Testing

  • Added 8 gpui::test cases in git_panel.rs covering: shift-click range selection in flat and tree view, plain-click collapse, selection surviving a flat→tree rebuild, multi View File, multi stage via ToggleStaged, multi Open File Diff, and multi View File History.
  • Reviewers can test manually: open the Git Panel with several changed files, Shift-click to select a range, then try Stage/Unstage, Discard (check the plural prompt), Open File Diff, View File, and View File History; verify plain click and empty-area click reset the selection, and that switching flat/tree view keeps the marks.

The demonstration video is as follows:

CleanShot.2026-08-30.at.19.43.00.mp4

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards (UX/UI and icon guidelines)
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Showcase

Click to view interactions
  • Shift + click → selects the range from the anchor to the clicked file (highlighted rows)
  • Right-click a selected file → group actions with plural titles ("Stage Files", "Trash Files", "Restore Files")
  • Click empty space below the list → clears the selection

(screenshot/GIF placeholder — record before submitting if desired)


Release Notes:

  • Added Shift-click multi-select in the Git Panel, enabling batch stage/unstage, discard, open diff, view file, and view history for multiple files

Copilot AI lite review requested due to automatic review settings August 30, 2026 11:48
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Aug 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Shift-click range multi-select to the Git Panel and updates Git Panel actions to operate on the marked (multi-selected) entries when present, including opening multiple file diffs / files / histories. Also updates the File History action renderer to support multiple targets and adds GPUI tests covering the new selection + batch-action behavior.

Changes:

  • Introduce marked_entries-driven multi-selection with Shift-click range selection, plain-click collapse, and empty-area click deselect.
  • Update Git Panel actions (stage/unstage, revert, view file, open file diff, gitignore/exclude, file history targets) to operate on selected_status_entries().
  • Add GPUI tests covering multi-select selection semantics and multi-target actions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
crates/git_ui/src/git_panel.rs Implements multi-selection behavior, updates multiple actions to operate on marked entries, and adds GPUI tests.
crates/git_ui/src/git_graph.rs Extends File History action handling to open history for multiple selected targets.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/git_ui/src/git_panel.rs Outdated
Comment thread crates/git_ui/src/git_panel.rs Outdated
Comment thread crates/git_ui/src/git_panel.rs
@zed-zippy zed-zippy Bot added the no self-review PRs that likely lack self-review label Aug 30, 2026
@ChristopherBiscardi ChristopherBiscardi added the area:integrations/git Git integration feedback label Aug 31, 2026
@ChristopherBiscardi ChristopherBiscardi self-assigned this Aug 31, 2026
@zed-industries-bot

Copy link
Copy Markdown
Contributor
Fails
🚫 Please self-review your PR before submitting — README.md contains a line that asks to be removed which you should have spotted.

Generated by 🚫 dangerJS against 0e17646

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:integrations/git Git integration feedback cla-signed The user has signed the Contributor License Agreement no self-review PRs that likely lack self-review

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Git Panel can support to hold down Shift key to make multiple selections. Multi-select files in the git panel

4 participants