Add 'git: view commit' command palette action
adds a 'git: view commit' – accepting a ref (e.g. HEAD, an sha, etc) to more easily navigate to the git commit view.
if a bad ref is entered, the user is shown a generic error
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
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).
@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.
@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
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!
here's the PR for the URI scheme feature, similar to this one: https://github.com/zed-industries/zed/pull/43341