- Notifications
You must be signed in to change notification settings - Fork 6k
Add git blame #8889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add git blame #8889
Conversation
e08ff3c to 348e0c6 Compare | This will be a very handy feature. This is out of scope for now but, while I use blame in VSCode, 99% of the time it's a hover to see which PR introduced the commit and to click the link to view the PR on Github. |
348e0c6 to d8f57ac Compare 3632d6f to 6e9bee1 Compare | Oooooh! If this prototype goes through, this will be super awesome! |
dedeb0a to f16f6ac Compare | Current preview: screenshot-2024-03-19-18.36.18.mp4 |
| Collaboration works! Now all that's left is bundling screenshot-2024-03-27-19.59.35.mp4 |
Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Antonio <antonio@zed.dev>
e86b49d to 01e6861 Compare | @mrnugget I've been using this in Update: nvm, I see a |
| Even though this is merged, I have a question @mrnugget. I'm curious as to why the code cannot just use git2::Blame for this. git2::Blame has Blame::blame_buffer which I believe would do the same thing as calling |
| @baldwindavid yep, that's the one. @mmtftr because it's very, very slow. See here: libgit2/libgit2#3027 Running |

This adds a new action to the editor:
editor: toggle git blame. When used it turns on a sidebar containinggit blameinformation for the currently open buffer.The git blame information is updated when the buffer changes. It handles additions, deletions, modifications, changes to the underlying git data (new commits, changed commits, ...), file saves. It also handles folding and wrapping lines correctly.
When the user hovers over a commit, a tooltip displays information for the commit that introduced the line. If the repository has a remote with the name
originconfigured, then clicking on a blame entry opens the permalink to the commit on the code host.Users can right-click on a blame entry to get a context menu which allows them to copy the SHA of the commit.
The feature also works on shared projects, e.g. when collaborating a peer can request
git blamedata.As of this PR, Zed now comes bundled with a
gitbinary so that users don't have to havegitinstalled locally to use this feature.Screenshots
TODOs
gitbinaryRelease Notes
Release Notes:
editor: toggle git blamecommand that toggles a sidebar with git blame information for the current buffer.