Open-Source Wikis

/

Zed

/

Features

/

Git integration

zed-industries/zed

Git integration

Active contributors: cole-miller, danilo-leal, yara-blue, kubkon, Anthony-Eid, cameron1024

Purpose

Zed has first-class Git: inline blame, gutter hunk indicators, a status panel, branch switching, commit / amend, history view, and a graph view. Recent work added bare-repo support (Improve bare repo support (#55153)) and a "jump to project file from commit" affordance (git_ui: Add option to jump to project file from commit (#55088)).

Crates

Crate Role
crates/git Git plumbing (libgit2-backed where applicable)
crates/git_ui Status panel, commit UI, gutter integration
crates/git_graph History graph view
crates/git_hosting_providers GitHub / GitLab / Bitbucket / Gitea-aware features
crates/buffer_diff Per-line diff state used by gutter and inline views
crates/project (git_store) Per-project Git status cache

Key abstractions

Type File Description
GitStore crates/project/src/git_store.rs Cached repo state per project
Repository crates/git/src/... One git repo (local or bare)
BlameInfo crates/git/src/... Per-line blame
Hunk crates/buffer_diff/src/buffer_diff.rs Per-line diff entry
GitPanel crates/git_ui/src/git_panel.rs The status / staging panel
HistoryView crates/git_ui/src/... Per-file history view (with the new "jump to file" action)

How it works

graph TD
    Worktree --> GitStore
    GitStore -->|shell out / libgit2| Repo[(.git)]
    GitStore --> Hunks[buffer_diff::Hunk]
    Hunks --> Editor[Editor gutter]
    GitStore --> Panel[git_ui::GitPanel]
    GitStore --> Graph[git_graph]
    Panel -->|stage / commit| Repo
    Panel --> Hosting[git_hosting_providers]
    Hosting --> GH[GitHub / GitLab / ...]

Status updates

GitStore watches .git/index for changes (or polls when watching is unavailable). Status updates fan out to the panel and to the editor's gutter. Hunks are computed by buffer_diff against either HEAD or the current branch's upstream, configurable.

Inline blame

The editor can show blame as a trailing dim text on each line, or in a popover summoned by command. The data comes from git blame runs cached per file, invalidated on commits.

Hosting providers

crates/git_hosting_providers adds host-aware URLs (e.g. "Open in GitHub", "Copy permalink"). The list is extensible; extensions can register additional providers.

Bare repo support

A recent improvement makes Zed work in bare repos (Improve bare repo support (#55153)). The store knows there is no working tree and adjusts diff and status behaviour accordingly.

Entry points for modification

  • New gutter affordance — crates/git_ui/src/... plus the editor element.
  • New history-view feature — crates/git_ui/src/... and crates/git_graph.
  • New hosting provider — crates/git_hosting_providers/src/<provider>.rs.
  • Plumbing changes — crates/git/src/....
  • Editor — gutter integration
  • ProjectGitStore is part of Project

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Git integration – Zed wiki | Factory