Skip to content
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

Tracking Issue: git integration #8665

Open
5 tasks done
mrnugget opened this issue Mar 1, 2024 · 26 comments
Open
5 tasks done

Tracking Issue: git integration #8665

mrnugget opened this issue Mar 1, 2024 · 26 comments
Labels
git Git integration feedback ignore top-ranking issues [ignored label] tracking Issue that tracks a group of related issues

Comments

@mrnugget
Copy link
Member

mrnugget commented Mar 1, 2024

Problem

Our current git integration is very minimal. What we have:

  • showing current branch, selecting branches
  • showing git status in gutter, until changes are staged
  • showing git status in project panel
  • navigating to previous/next hunk

Many users are asking for more git integration:

Goal

Build a 0.1 of git integration that fixes immediate pain points and stops users from leaving Zed to go to GitHub, GitLab, or another editor to use a git feature.

The most common git interactions should be doable inside Zed: committing, staging, unstaging, viewing diffs, ...

They should allow keyboard-only workflow.

Current status

Work on git integration is paused at the moment, since we're spread too thin on a lot of other projects.

Roadmap

Ranking here very subjective and based on personal pain points.

Milestone 1 - git blame

Milestone 2 - git diff

  • Support diffs
    • Allow opening diffs from git status view

Milestone 3 - git status & git commit

  • git status view
    • see: working directory is clean or dirty
    • see: untracked, unstaged, staged files
    • do: stage/unstage files
  • git commit
    • triggered from git status view
    • opens git commit message

Things we have to do

  • Support opening sub-folders (or single files) of git repositories

Milestone ...

@mrnugget mrnugget added meta git Git integration feedback tracking Issue that tracks a group of related issues labels Mar 1, 2024
@Moshyfawn
Copy link
Contributor

I think #8663 can be added here.

@d1y
Copy link
Contributor

d1y commented Mar 3, 2024

I am really looking forward to using most of the gitsigns.nvim features in zed: #6780

@jaskerv
Copy link

jaskerv commented Mar 4, 2024

Can I add a feature request for a option to have file changed in a tree view? 🙏

@justAdevTV
Copy link

I want git blame

@uroybd
Copy link

uroybd commented Mar 14, 2024

Conventional commit support in git commit will be great.

Alternatively, we can allow plugins to take care of these things like this one: https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits

@taunusflieger
Copy link

Would be nice if you work in a folder below the git root and get ask if you want to locate the repo (as it is done in vscode). Currently if you are not opening the git root, but a sub directory git support is not enabled.

@mrnugget mrnugget mentioned this issue Mar 18, 2024
1 task
@savoygrizzly
Copy link

Just wanted to drop in there that the new git integration should allow for multiple git's inside an open folder, I like to be able to have my container open so I can work on multiple services at the same time.

@Ph0enixKM
Copy link

We could also have some form of Merge Editor like it is in Visual Studio Code or maybe something even better

@fhamm
Copy link

fhamm commented Apr 16, 2024

It would also be great if the proposed source control view is compatible with git submodules, similar to VS Code =)

@Moshyfawn
Copy link
Contributor

@mrnugget you might want to link to #10807 where you mention the history milestone.

@mrnugget
Copy link
Member Author

Update here: we're going to pause work on the git integration for a few weeks, since we have a lot of projects going on right now — Tasks, Linux, remoting, AI — and are spread a bit too thin. Since we've reached a good pause-point here (just checked off Milestone 1), we'll pause work on git, focus on other projects for a while and then come back to git integration once we've finished other projects or reached significant milestones.

@SomeoneToIgnore
Copy link
Contributor

To soften the wait slightly, I hope to finish and merge #11080 that enabled git hunk diffs browsing in the editor.
It's not a full diff view, but something useful still.

@indrajit-roy
Copy link

indrajit-roy commented Apr 28, 2024

@mrnugget Can the community contribute to this? It would be nice to see the approach and design hosted somewhere so that interested folks can help speed up the process. I myself would like to switch to Zed permanently and am more than willing to help ship this asap. This is a huge and the only blocker for me right now.

@SomeoneToIgnore
Copy link
Contributor

SomeoneToIgnore commented Apr 28, 2024

Of course it can, this is the whole point of Zed being open source.

I would suggest starting from something small-scoped, come up with the proposals and (ideally) some design drafts to discuss it first — defining the right chunk of work is the most complicated first step here, it seems.

Be wary that some subtasks of this "epic" are quite hard, e.g. the whole "show a two panel diff" story will require writing something like https://github.com/zed-industries/zed/blob/main/crates/editor/src/display_map/inlay_map.rs but for git things.

@indrajit-roy
Copy link

Of course it can, this is the whole point of Zed being open source.

I would suggest starting from something small-scoped, come up with the proposals and (ideally) some design drafts to discuss it first — defining the right chunk of work is the most complicated first step here, it seems.

Of course. Just want the existing specs to be highlighted so that anyone taking this up doesn't re think anything that's already decided on.

@SomeoneToIgnore
Copy link
Contributor

I suspect there's nothing well formed, covering the entire integration task, only a few ideas split between people (right now I work on something related to diffs, there are some design drafts, etc.).
See also notes in the https://zed.dev/channel/git-5484 channel for a rough plan on how to move it forward.

So, any proposal could easily be better than the current state. I would not take too much of an effort to draw detailed designs, as @\iamnbutler might have better ideas, but otherwise anything is free to be picked up due to #8665 (comment)

@mrnugget
Copy link
Member Author

Anyone's free to help, sure, although I would caution against picking up one of the bigger items — git commit view, git status view, git diff view — since they require a lot of design and conceptual thinking up front on and the Zed team does have opinions on all of them, we just need to find the time to get to it.

@MarcARoberge
Copy link

MarcARoberge commented May 10, 2024

May I suggest a small increment for the git diff view? With the help of the hunk feature recently merged, we could add a "filter" to only see in the project panel the files with the git-status changed. This way we could get a list of all files and if we want to see the diff, we could use the expand all hunks feature for now.

@ophilli
Copy link

ophilli commented May 13, 2024

It would be really nice to have a "Right Click > Open in github.com" or similar for lines that have a clear git blame.

@mrnugget
Copy link
Member Author

It would be really nice to have a "Right Click > Open in github.com" or similar for lines that have a clear git blame.

@ophilli: You can already click on the commit sha here to open it on the code host:

screenshot-2024-05-13-09 26 18@2x

But I also just opened this PR: #11734

@kevinfaveri
Copy link

May I suggest a small increment for the git diff view? With the help of the hunk feature recently merged, we could add a "filter" to only see in the project panel the files with the git-status changed. This way we could get a list of all files and if we want to see the diff, we could use the expand all hunks feature for now.

hey @mrnugget this seems a really low hanging fruit, allowing to filter files in files view by git status being modified. Is anything we can expedite quickly? Would really help with easily going to files that got modified in a "stable sidebar"

@SomeoneToIgnore
Copy link
Contributor

@kevinfaveri

I would argue about really easy, as the devil is in the ergonomics details.
The main line of questions to your proposal is: what to do with those filtered items in the project panel? Given most other tool experience, there should be click listeners, showing the diffs somewhere, how Zed is supposed to display this and how all those items are interacting with each other?

My current idea is to reuse current git hunk diffs (inline diffs) functionality, and show all changed places of a singleton buffer inside of a multi buffer (as for search results: we do not show the entire file with multiple matches inside, but rather show take excerpts around the matches and show those in a multi buffer), with the diff hunks expanded always (?).

As a first attempt, I will use a single multi buffer for all file entries, and get a project panel to show only the entries, related to excerpts of that large multi buffer — those will be all files that have some git changed metadata (modified/added/removed/conflict/etc.).
Project panel now only shows real files, but that might not be very ergonomic for large files with many changes, so some fake entries might be required.
And whatever the entries are, they still have to support previous project panel features, but for a companion multi buffer now:

  • select a corresponding file when multi buffer's selection changes, also support a reveal action
  • scroll to an excerpt when clicking a project panel entry (instead of opening the editor for the file as we only do now)
  • directory expands/unexpands and fold/unfolds

Currently, I have a main...kb/buffer-panel branch that, while not related to the git diff explicitly, allows to have a companion "project panel" for any generic multi buffer, with the practical emphasis on the project search view.

Moreover, this is the first time in project panel's code history to add some filters on top of the current "all files in the project"-only approach, and besides all the above, it has to deal with performance implication — we can definitely do better than the branch does currently.


So, I think I'm getting there and the road is interesting and possible conceptually.
A good amount of work and wiring has to happen along the way though, so maybe I'm not over by the end of June but who knows.

@joaodlf
Copy link

joaodlf commented May 30, 2024

I would recommend the Zed team (or anyone building software like this) to take a look at the way Jetbrains handles git integration. From basic functionality like commit/pull, to the amazing log interface, as well as the individual file history feature that fits into the git log UI. Even small things like being able to quickly open a file+line number in GitHub/Gitlab. Jetbrains has completely nailed their git integration, it's a fundamental aspect of my productivity and very hard to move away from.

edit: in fact, this thing is so good, the community is asking for a standalone git client from them: https://youtrack.jetbrains.com/issue/IJPL-72504/Make-git-client-a-standalone-app

@indrajit-roy-sc
Copy link

Completely agree with @joaodlf

If Zed can nail JetBrains' level Git integration and at the same time keep the memory consumption close to what it is right now, it will be the hugest win in the world of IDEs.

@cole-abbeduto-particle
Copy link

Would love to see a list of remote branches to be able to easily select in the dropdown like Webstorm has 🙏

@szabba
Copy link

szabba commented Jun 1, 2024

As a counterpoint: I personally avoid most git-related features in IntelliJ like the plague - with the exception of 3-way merge. The UI is complex and confusing, I recall operations having non-git names - I've learned git first, IntelliJ second, so that's beyond unhelpful. I've found that when I use VS Code I use the provided git integration much more readily.

@JosephTLyons JosephTLyons added ignore top-ranking issues [ignored label] and removed meta labels Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
git Git integration feedback ignore top-ranking issues [ignored label] tracking Issue that tracks a group of related issues
Projects
None yet
Development

No branches or pull requests