Skip to content

git_panel: Add group by staging view option - #59884

Merged
ChristopherBiscardi merged 17 commits into
zed-industries:mainfrom
chirivelli:feat/git-panel-group-by-staging
Jul 11, 2026
Merged

git_panel: Add group by staging view option#59884
ChristopherBiscardi merged 17 commits into
zed-industries:mainfrom
chirivelli:feat/git-panel-group-by-staging

Conversation

@chirivelli

@chirivelli chirivelli commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Objective

  • Add a view option for group by staging.

Solution

  • Add a new option for group_by under git_panel view options, with 2 sections "Staged" and "Unstaged", with buttons (+/-) to stage and unstage

Testing

  • cargo check -p git_ui

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

Screenshot 2026-06-25 at 2 09 44 PM

Release Notes:

  • Added group by staging view option

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 25, 2026
@chirivelli

Copy link
Copy Markdown
Collaborator Author

Looking for feedback on this!

@soaresluciano

Copy link
Copy Markdown

Thanks for working on this one! It looks great. As a suggestion, it would be nice to keep the conflict group as well. In my opinion, it's nice to have it at the top (like in VS Code). That helps draw attention to those items and also serves as a visual cue.

@chirivelli
chirivelli force-pushed the feat/git-panel-group-by-staging branch from 48b80fc to a088c59 Compare July 2, 2026 07:40
@chirivelli

Copy link
Copy Markdown
Collaborator Author

@soaresluciano

Added Conflicts Section with "Mark as Resolved" action

Screen.Recording.2026-07-02.at.2.42.13.PM.mov

@chirivelli
chirivelli marked this pull request as ready for review July 2, 2026 09:15
@soaresluciano

Copy link
Copy Markdown

It looks fantastic! Good job!

@smitbarmase smitbarmase added the area:integrations/git Git integration feedback label Jul 3, 2026
@ChristopherBiscardi ChristopherBiscardi self-assigned this Jul 6, 2026
@ChristopherBiscardi

Copy link
Copy Markdown
Contributor

I know you've seen #46541 already, but its worth noting that there's active work happening there. I'm not sure how much crossover there will end up being but it seems like its going to get pushed up soon.

@chirivelli

chirivelli commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

@ChristopherBiscardi
The scope is slightly different (Git Panel View option vs Introducing Staged Diff View),
I will wait for it to merge and update this as needed (or close).

@chirivelli

Copy link
Copy Markdown
Collaborator Author

#46541 has been merge, adds Staged and Unstaged Diff Views,

I'll rebase on top of the new change.
make the group-by-staging view, section aware to open in Staged/Unstage Diff instead of Project Diff (or Uncommitted Changes)

@chirivelli
chirivelli force-pushed the feat/git-panel-group-by-staging branch from ddfbfc0 to 2b47525 Compare July 7, 2026 09:09
@chirivelli

Copy link
Copy Markdown
Collaborator Author

Changes in Staged section open in Staged Diff View and similarly for Unstaged changes

Screen.Recording.2026-07-07.at.7.17.51.PM.mov

@chirivelli

chirivelli commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

@ChristopherBiscardi I think this is it for this PR.

I am leaving git diff stats (scoped for staged and unstaged sections) out of this, as this is already a large PR.
I will work on it if and after this is merged. (or happy to include in this itself if thats ok)

@praveenihiddentalent

Copy link
Copy Markdown

@chirivelli What is the difference between your work #59884 and #59025

@chirivelli

chirivelli commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

What is the difference between your work #59884 and #59025

  1. Admittedly not much, but this is more customisable imo (leaves the old grouping option available).
  2. Uses a different UX
  • Instead of checkboxes this uses "+/-" buttons to stage and unstage (similar to other editors).
  • A "✓" to mark as resolved for conflicts.
  1. I'm leaving the Git stats out of this for now. To not change too many files.

@ChristopherBiscardi
ChristopherBiscardi added this pull request to the merge queue Jul 11, 2026
Merged via the queue into zed-industries:main with commit 65e1c5a Jul 11, 2026
34 checks passed
@chirivelli
chirivelli deleted the feat/git-panel-group-by-staging branch July 11, 2026 15:10
@ChristopherBiscardi

Copy link
Copy Markdown
Contributor

@zed-industries/approved

RemcoSmitsDev pushed a commit to RemcoSmitsDev/zed that referenced this pull request Jul 14, 2026
…industries#60976)

Follow up to zed-industries#59884

This PR refines how the git panel behaves when grouping changes by
staging state, with a focus on making staging workflows predictable and
conflict resolution safe.

- Renamed the "Group By" menu options to describe what you actually see:
**"Tracked & Untracked"** (was "Status") and **"Staged & Unstaged"**
(was "Staging").
- When grouping by staged & unstaged, both sections now stay visible
even when empty, showing a placeholder message ("No staged changes yet"
/ "No unstaged changes"). Previously an empty section disappeared
entirely, which made the panel layout jump around as you staged and
unstaged files, and made it harder to tell at a glance that nothing was
staged yet.
- Section header controls are now consistent checkboxes everywhere
(previously a mix of checkboxes and +/− icon buttons), with "Stage All"
/ "Unstage All" tooltips. Headers of empty sections render no checkbox
and don't react to clicks or hover. I appreciate the debate that
happened in the PR linked above about this but I was personally having a
hard time understanding what was the difference in interaction given the
action was exactly the same, we were just having different UIs, which
looked inconsistent.
- Arrow-key navigation now skips over section headers and empty-section
placeholder rows in both flat and tree view, instead of getting stuck or
selecting non-interactive rows — including when jumping to the first or
last entry.
- In the staged & unstaged grouping, a partially staged file appears in
both sections. Each row's checkbox and tooltip now follow the section
it's rendered in: rows in Staged always unstage, rows in Unstaged always
stage — including via shift-click range operations, which now also
support bulk *unstaging* within the Staged section (previously ranges
could only stage). The context menu's Stage/Unstage label follows the
same rule and stays in sync with in-flight staging operations.
- Conflicted files are grouped by whether the current merge marked them
conflicted (rather than raw status), so a conflict you've resolved stays
visible under "Conflicts" until the merge concludes. On top of that,
resolution is now one-way in the UI:
- Ticking a conflicted file's checkbox marks it resolved (stages it).
Once resolved, the checkbox is disabled with a "Conflict marked as
resolved" tooltip — unticking it would silently discard git's record of
the unmerged base/ours/theirs versions, a round-trip git can't actually
perform.
- The same lock applies everywhere the file can be reached: the keyboard
toggle, folder checkboxes in tree view, the Conflicts section header
(disabled once all conflicts are resolved), "Stage All"/"Unstage All" on
the Staged/Unstaged headers, and shift-click range sweeps — none of them
will resolve or un-resolve a conflict as a side effect.
- The explicit `git: unstage file` action still works as a deliberate
escape hatch.

---

Here's a video, where you can see I stage and unstage whole files, make
a partial staging, and get into a merge-conflict state, where the
conflicted files are tagged as resolved:


https://github.com/user-attachments/assets/d27ef9c6-5691-45c1-91ab-c3b152aaaa60

---

Release Notes:

- N/A _(given the feature hasn't been released yet_)
@leovanzella

Copy link
Copy Markdown

thanks for adding that, It looks great!

@mansoorkhan96

mansoorkhan96 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Is this released?

Update: Not yet, might get released in next one which is July 22.

@leovanzella

Copy link
Copy Markdown

One minor improvement would be to see in Unstaged just the diff changes between Staged and Unstaged.

@xybr-dev

xybr-dev commented Jul 17, 2026

Copy link
Copy Markdown

Is this released?

Update: Not yet, might get released in next one which is July 22.

It's already up in the preview build v1.12.0-pre, see first bullet under Git.

Though most likely be pushed to stable next week!

@pknrs

pknrs commented Jul 17, 2026

Copy link
Copy Markdown

@chirivelli I noticed an issue in the Zed preview build, I have logged it

#61205

Konadu-Akwasi-Akuoko pushed a commit to zedium-editor/zedium that referenced this pull request Jul 18, 2026
# Objective

- Show accurate diff stats for each staged and unstaged projection of a
partially staged file in the Git panel.
- This was originally considered for
zed-industries/zed#59884, but was scoped out of
that already-large PR and is being submitted separately as discussed
there.

## Solution

- Collect HEAD-to-index and index-to-worktree diff stats alongside the
existing combined HEAD-to-worktree stats.
- Carry the staged and unstaged stats through repository status
snapshots and remote status serialization.
- Use the stat matching the projected Git panel section while preserving
the combined stat for the other grouping modes.
- Update the fake Git repository and add regression coverage with
deliberately different staged and unstaged counts.

## Testing

- `cargo check -p git_ui`
- `cargo check -p collab`
- `cargo test -p git_ui
test_group_by_staging_section_membership_and_order --lib`
- `cargo test -p project --lib --no-run`
- `cargo fmt --all -- --check`
- `git diff --check`

## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed diff stats for partially staged files in the Git panel
@marcoafm26

Copy link
Copy Markdown

@chirivelli I had to personally come here after seeing the release notes, thank you so much!

@chirivelli

Copy link
Copy Markdown
Collaborator Author

@chirivelli I had to personally come here after seeing the release notes, thank you so much!

Thanks 🙏! Do lmk if you have any issues or any features that you feel like are missing.

@COUSCOUSZ

Copy link
Copy Markdown

Thanks @chirivelli, and everyone who contributed.

@marcoafm26

Copy link
Copy Markdown

@chirivelli just one question, the changes on unstaged should be the total number or only new changes made after staging the firs ones? I've being using along the day and noticed that.

Anyway, really good job for everyone!

image

@SGLara

SGLara commented Jul 28, 2026

Copy link
Copy Markdown

Hey thanks so much for this addition @chirivelli , this was a feat I was waiting for and kept me from moving from vs code to this one! ❤️

@mantou132

Copy link
Copy Markdown

Thank you for making this implementation, I have been using this feature for a long time.

I have a question: Why does discard changes in unstaged not only cancel the changes in unstaged?

image

jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
# Objective

- Add a view option for group by staging.

## Solution

- Add a new option for group_by under git_panel view options, with 2
sections "Staged" and "Unstaged", with buttons (+/-) to stage and
unstage

## Testing

- cargo check -p git_ui

## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

<img width="1679" height="1140" alt="Screenshot 2026-06-25 at 2 09
44 PM"
src="https://github.com/user-attachments/assets/1b605cad-7792-4823-983c-ada41be25504"
/>


---

Release Notes:

- Added group by staging view option

---------

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

Follow up to zed-industries#59884

This PR refines how the git panel behaves when grouping changes by
staging state, with a focus on making staging workflows predictable and
conflict resolution safe.

- Renamed the "Group By" menu options to describe what you actually see:
**"Tracked & Untracked"** (was "Status") and **"Staged & Unstaged"**
(was "Staging").
- When grouping by staged & unstaged, both sections now stay visible
even when empty, showing a placeholder message ("No staged changes yet"
/ "No unstaged changes"). Previously an empty section disappeared
entirely, which made the panel layout jump around as you staged and
unstaged files, and made it harder to tell at a glance that nothing was
staged yet.
- Section header controls are now consistent checkboxes everywhere
(previously a mix of checkboxes and +/− icon buttons), with "Stage All"
/ "Unstage All" tooltips. Headers of empty sections render no checkbox
and don't react to clicks or hover. I appreciate the debate that
happened in the PR linked above about this but I was personally having a
hard time understanding what was the difference in interaction given the
action was exactly the same, we were just having different UIs, which
looked inconsistent.
- Arrow-key navigation now skips over section headers and empty-section
placeholder rows in both flat and tree view, instead of getting stuck or
selecting non-interactive rows — including when jumping to the first or
last entry.
- In the staged & unstaged grouping, a partially staged file appears in
both sections. Each row's checkbox and tooltip now follow the section
it's rendered in: rows in Staged always unstage, rows in Unstaged always
stage — including via shift-click range operations, which now also
support bulk *unstaging* within the Staged section (previously ranges
could only stage). The context menu's Stage/Unstage label follows the
same rule and stays in sync with in-flight staging operations.
- Conflicted files are grouped by whether the current merge marked them
conflicted (rather than raw status), so a conflict you've resolved stays
visible under "Conflicts" until the merge concludes. On top of that,
resolution is now one-way in the UI:
- Ticking a conflicted file's checkbox marks it resolved (stages it).
Once resolved, the checkbox is disabled with a "Conflict marked as
resolved" tooltip — unticking it would silently discard git's record of
the unmerged base/ours/theirs versions, a round-trip git can't actually
perform.
- The same lock applies everywhere the file can be reached: the keyboard
toggle, folder checkboxes in tree view, the Conflicts section header
(disabled once all conflicts are resolved), "Stage All"/"Unstage All" on
the Staged/Unstaged headers, and shift-click range sweeps — none of them
will resolve or un-resolve a conflict as a side effect.
- The explicit `git: unstage file` action still works as a deliberate
escape hatch.

---

Here's a video, where you can see I stage and unstage whole files, make
a partial staging, and get into a merge-conflict state, where the
conflicted files are tagged as resolved:


https://github.com/user-attachments/assets/d27ef9c6-5691-45c1-91ab-c3b152aaaa60

---

Release Notes:

- N/A _(given the feature hasn't been released yet_)
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
# Objective

- Show accurate diff stats for each staged and unstaged projection of a
partially staged file in the Git panel.
- This was originally considered for
zed-industries#59884, but was scoped out of
that already-large PR and is being submitted separately as discussed
there.

## Solution

- Collect HEAD-to-index and index-to-worktree diff stats alongside the
existing combined HEAD-to-worktree stats.
- Carry the staged and unstaged stats through repository status
snapshots and remote status serialization.
- Use the stat matching the projected Git panel section while preserving
the combined stat for the other grouping modes.
- Update the fake Git repository and add regression coverage with
deliberately different staged and unstaged counts.

## Testing

- `cargo check -p git_ui`
- `cargo check -p collab`
- `cargo test -p git_ui
test_group_by_staging_section_membership_and_order --lib`
- `cargo test -p project --lib --no-run`
- `cargo fmt --all -- --check`
- `git diff --check`

## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed diff stats for partially staged files in the Git panel
@elv1n

elv1n commented Aug 10, 2026

Copy link
Copy Markdown

Great feature, now the question is how to keep the position once the file moved to staged. After adding the file into staged I want to see the next file right after the shortcut, or by another hot key.

playdohface pushed a commit to playdohface/zed that referenced this pull request Aug 29, 2026
# Objective

- Add a view option for group by staging.

## Solution

- Add a new option for group_by under git_panel view options, with 2
sections "Staged" and "Unstaged", with buttons (+/-) to stage and
unstage

## Testing

- cargo check -p git_ui

## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

<img width="1679" height="1140" alt="Screenshot 2026-06-25 at 2 09
44 PM"
src="https://github.com/user-attachments/assets/1b605cad-7792-4823-983c-ada41be25504"
/>


---

Release Notes:

- Added group by staging view option

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
playdohface pushed a commit to playdohface/zed that referenced this pull request Aug 29, 2026
…industries#60976)

Follow up to zed-industries#59884

This PR refines how the git panel behaves when grouping changes by
staging state, with a focus on making staging workflows predictable and
conflict resolution safe.

- Renamed the "Group By" menu options to describe what you actually see:
**"Tracked & Untracked"** (was "Status") and **"Staged & Unstaged"**
(was "Staging").
- When grouping by staged & unstaged, both sections now stay visible
even when empty, showing a placeholder message ("No staged changes yet"
/ "No unstaged changes"). Previously an empty section disappeared
entirely, which made the panel layout jump around as you staged and
unstaged files, and made it harder to tell at a glance that nothing was
staged yet.
- Section header controls are now consistent checkboxes everywhere
(previously a mix of checkboxes and +/− icon buttons), with "Stage All"
/ "Unstage All" tooltips. Headers of empty sections render no checkbox
and don't react to clicks or hover. I appreciate the debate that
happened in the PR linked above about this but I was personally having a
hard time understanding what was the difference in interaction given the
action was exactly the same, we were just having different UIs, which
looked inconsistent.
- Arrow-key navigation now skips over section headers and empty-section
placeholder rows in both flat and tree view, instead of getting stuck or
selecting non-interactive rows — including when jumping to the first or
last entry.
- In the staged & unstaged grouping, a partially staged file appears in
both sections. Each row's checkbox and tooltip now follow the section
it's rendered in: rows in Staged always unstage, rows in Unstaged always
stage — including via shift-click range operations, which now also
support bulk *unstaging* within the Staged section (previously ranges
could only stage). The context menu's Stage/Unstage label follows the
same rule and stays in sync with in-flight staging operations.
- Conflicted files are grouped by whether the current merge marked them
conflicted (rather than raw status), so a conflict you've resolved stays
visible under "Conflicts" until the merge concludes. On top of that,
resolution is now one-way in the UI:
- Ticking a conflicted file's checkbox marks it resolved (stages it).
Once resolved, the checkbox is disabled with a "Conflict marked as
resolved" tooltip — unticking it would silently discard git's record of
the unmerged base/ours/theirs versions, a round-trip git can't actually
perform.
- The same lock applies everywhere the file can be reached: the keyboard
toggle, folder checkboxes in tree view, the Conflicts section header
(disabled once all conflicts are resolved), "Stage All"/"Unstage All" on
the Staged/Unstaged headers, and shift-click range sweeps — none of them
will resolve or un-resolve a conflict as a side effect.
- The explicit `git: unstage file` action still works as a deliberate
escape hatch.

---

Here's a video, where you can see I stage and unstage whole files, make
a partial staging, and get into a merge-conflict state, where the
conflicted files are tagged as resolved:


https://github.com/user-attachments/assets/d27ef9c6-5691-45c1-91ab-c3b152aaaa60

---

Release Notes:

- N/A _(given the feature hasn't been released yet_)
playdohface pushed a commit to playdohface/zed that referenced this pull request Aug 29, 2026
# Objective

- Show accurate diff stats for each staged and unstaged projection of a
partially staged file in the Git panel.
- This was originally considered for
zed-industries#59884, but was scoped out of
that already-large PR and is being submitted separately as discussed
there.

## Solution

- Collect HEAD-to-index and index-to-worktree diff stats alongside the
existing combined HEAD-to-worktree stats.
- Carry the staged and unstaged stats through repository status
snapshots and remote status serialization.
- Use the stat matching the projected Git panel section while preserving
the combined stat for the other grouping modes.
- Update the fake Git repository and add regression coverage with
deliberately different staged and unstaged counts.

## Testing

- `cargo check -p git_ui`
- `cargo check -p collab`
- `cargo test -p git_ui
test_group_by_staging_section_membership_and_order --lib`
- `cargo test -p project --lib --no-run`
- `cargo fmt --all -- --check`
- `git diff --check`

## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed diff stats for partially staged files in the Git panel
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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.