zed icon indicating copy to clipboard operation
zed copied to clipboard

Add 'git: view commit' command palette action

Open schpet opened this issue 2 months ago • 5 comments

adds a 'git: view commit' – accepting a ref (e.g. HEAD, an sha, etc) to more easily navigate to the git commit view.

Screenshot 2025-09-26 at 21 43 09@2x

if a bad ref is entered, the user is shown a generic error

Screenshot 2025-09-27 at 21 04 52@2x

happy to adjust any of that. also worth noting is the git: branch command UI is a bit nicer, can e.g. show you some metadata on the commit before you select it, so happy to take it further in that direction if desired, but thought i'd keep it simple to start.

Release Notes:

  • Added view commit command palette action

schpet avatar Sep 27 '25 05:09 schpet

Thanks! This seems useful, happy to merge as-is. If you're interested in taking it further, I like the idea of making it possible to see the commit metadata before opening it (and that would also give an affordance for showing the user that their query isn't valid immediately, instead of just showing a toast after they hit confirm).

cole-miller avatar Nov 11 '25 19:11 cole-miller

@schpet : In the future it would be nice to be able to suggest commits.

For example:

  • I enter a few characters of the reference commit that are in sequence, and it suggests the commit if it exists. For example, I enter the first n characters and it tells me which commits satisfy the query.
  • I enter the title of a commit and it suggests the commits that satisfy the query.

Angelk90 avatar Nov 11 '25 19:11 Angelk90

@cole-miller thanks for checking this out and the feedback! i've pushed a change adding some commit metadata, similar to the branch picker. video here showing it:

https://github.com/user-attachments/assets/4bd1a8fe-ac20-402a-8e7f-955bd39704c3

schpet avatar Nov 12 '25 05:11 schpet

as a follow up to this, i'm interested in URI support for the git commit view, i.e. supporting something along the lines of zed://git/path/to/repo#sha

this would allow customize the output of my git (or jj) log to use OSC 8 links to link git shas straight into zed – letting me use version control in the terminal, and review a diff of code changes in zed.

basically i'm finding myself in this situation

  • 📈 me looking at diffs
  • 📉 me looking at the working copy

which is reducing my time in zed, a place i like to be!

schpet avatar Nov 20 '25 23:11 schpet

here's the PR for the URI scheme feature, similar to this one: https://github.com/zed-industries/zed/pull/43341

schpet avatar Nov 22 '25 21:11 schpet