Skip to content

Add 'Diff With Commit' action#44467

Closed
davidbonan wants to merge 2 commits intozed-industries:mainfrom
davidbonan:git-view-file-diff-with-selected-commit
Closed

Add 'Diff With Commit' action#44467
davidbonan wants to merge 2 commits intozed-industries:mainfrom
davidbonan:git-view-file-diff-with-selected-commit

Conversation

@davidbonan
Copy link

Summary

Add a new command "git: Diff With Commit" that allows users to compare the current version of a file with any previous commit that modified it.

Features

  • Opens a commit picker modal showing the last 50 commits that modified the current file
  • Each commit displays: short SHA, author name, commit subject, and relative timestamp
  • Supports fuzzy search across SHA, author, subject, and message
  • Opens a diff view in a new tab showing changes between the selected commit and the current version

Implementation

  • Added DiffWithCommit action to git actions
  • Added show_file method to GitRepository trait to retrieve file content at a specific commit via git show :
  • Created CommitDiffPicker modal for commit selection
  • Created CommitFileDiffView for displaying the diff using the existing BufferDiff infrastructure
gitdiff.mov

Release Notes:

  • Added "git: Diff With Commit" command to compare the current file against any previous commit that modified it.

This change introduces a new action, 'Diff with Commit', which allows users to view the differences between the current file and a selected commit.

It implements the `show_file` method in the `GitRepository` trait and its implementations, enabling retrieval of file content at a specific commit. A new `CommitDiffPicker` is added to facilitate commit selection and display the diff in a dedicated view.
@cla-bot
Copy link

cla-bot bot commented Dec 9, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @davidbonan on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@davidbonan
Copy link
Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 9, 2025
@cla-bot
Copy link

cla-bot bot commented Dec 9, 2025

The cla-bot has been summoned, and re-checked this pull request!

@davidbonan davidbonan changed the title Adds 'Diff With Commit' action Add 'Diff With Commit' action Dec 10, 2025
@cole-miller
Copy link
Member

cole-miller commented Dec 16, 2025

Hi, thanks for opening a PR! I think this will be easier to review and hopefully get merged if you can break it up into smaller pieces. In particular, the commit picker seems like a useful feature in its own right (to start out with, selecting an entry could just show the diff from that commit for the entire project, using the existing CommitView infrastructure). Would you mind resubmitting that as its own PR?

@cole-miller
Copy link
Member

Closing due to lack of response, but I like the idea of the commit picker, please feel free to reopen with that as the focus!

@cole-miller cole-miller closed this Jan 8, 2026
@github-project-automation github-project-automation bot moved this from Community PRs to Done in Quality Week – December 2025 Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

Development

Successfully merging this pull request may close these issues.

2 participants