Skip to content

Add support for staged and unstaged changes in project diff view - #48792

Open
bnjjj wants to merge 2 commits into
zed-industries:mainfrom
bnjjj:bnjjj/fix_36703
Open

Add support for staged and unstaged changes in project diff view#48792
bnjjj wants to merge 2 commits into
zed-industries:mainfrom
bnjjj:bnjjj/fix_36703

Conversation

@bnjjj

@bnjjj bnjjj commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

Closes #36703

I asked several times on #36703 to know what kind of design we would like to have for this feature. I tried to add a non intrusive new select box to select the different diff views we would like to have. cc @cole-miller, @mattermill or @esthertrapadoux if you can give me feedback that would be really nice.

  • Code Reviewed
  • Manual QA

Screencast:

Enregistrement.de.l.ecran.2026-02-09.a.14.34.28.mov

Release Notes:

  • Add support of git staged and unstaged changes in project diff view

bnjjj added 2 commits February 9, 2026 14:38
…ndustries#36703

Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Feb 9, 2026
@github-actions github-actions Bot added the community champion Issues filed by our amazing community champions! 🫶 label Feb 9, 2026
@MrSubidubi MrSubidubi changed the title Add support of staged and unstaged changes in project diff view #36703 Add support for staged and unstaged changes in project diff view Feb 9, 2026
@nicojerome

Copy link
Copy Markdown

I need this so badly. Praying this gets merged sooner rather than later.

The select box is a perfectly clean, non-intrusive UI solution, IMO.

@bnjjj

bnjjj commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

I'm open to update it if needed, I just need feedback from zed team, cc @esthertrapadoux

@pastr

pastr commented Apr 27, 2026

Copy link
Copy Markdown

To review agents work this is incredibly useful

@SomeoneToIgnore SomeoneToIgnore added the area:integrations/git Git integration feedback label Apr 28, 2026
@sonny-campbell

Copy link
Copy Markdown

Agreeing that this is a really useful feature, but one question/piece of feedback on the design side. In most git tools we see a separation like this for staged vs unstaged, where all the changes and items are visible in a single pane, but logically separated. This makes it really easy to switch between staged/unstaged versions of the code and selectively stage sections for committing.

Is there a specific reason for using a different approach here? I can see that swapping being a little tedious when there are lots of changes to look through

Gitnuro
image

VS Code
image

Sourcetree:
image

@mateusduraes

Copy link
Copy Markdown

Hey,

Are there any plans in moving forward with this feature?

@maxbrunsfeld maxbrunsfeld left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @bnjjj, thanks for this — and sorry for the delayed review.

Since you opened this, we ended up implementing staged/unstaged diffs on main ourselves. The bulk of it landed in #58266 (a BufferDiff refactor by @cole-miller) and #46541 ("Git partially staged changes"), so the backend part of your PR now overlaps heavily with code that's already merged.

The main difference is in the data model for the index text. Your PR keeps the index content for the staged diff in a separate, standalone buffer that's manually kept in sync with the index, which is why the staged view has to be read-only. The refactor on main instead lets multiple diffs share the same base-text buffer entity: there's a single canonical index buffer that serves as the base of the unstaged diff and simultaneously the content of the staged diff, and a single head buffer shared by the staged and uncommitted diffs. Because there's one source of truth for the index, the staged view becomes interactive (you can unstage individual hunks straight from it), there's no risk of the two copies drifting, and it avoids a second full copy + foreground reparse of the file.

UI Work Needed

We are still open to contributions that add new UI around these diffs. Right now, the staged and unstaged diffs are only accessible by right-clicking a file in the git panel and choosing Staged Changes and Unstaged Changes - and we'd like to add a more clear way of accessing these views.

My concern about the dropdown that you added is that it might not interact well with the search bar that appears when you type command-f in the project diff view. It seems like that header could get very crowded.

If you're interested, you could rebase this PR onto main, removing the changes to the model layer (since main already has the needed core functionality) leaving only the UI parts of your PR, and share a video of what it looks like on a small screen when you have the search active.

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 community champion Issues filed by our amazing community champions! 🫶

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Git panel & Uncomitted Changes view is confusing for files with staged (but since undone) changes.

9 participants