Git Integration

Manage your version control workflows directly within Zed

Git Integration in Zed

Zed has built-in Git support so you can manage version control without leaving the editor. The Git Panel shows your working tree, staging area, and branch information. Changes you make on the command line are reflected immediately in Zed.

Key Git features in Zed include:

  • Git Panel with staging, commit, fetch, push, and pull
  • Project Diff multibuffer for reviewing and staging hunks
  • Branch management and Git worktrees
  • Merge conflict resolution UI
  • Stashing, inline blame, and gutter indicators
  • AI commit message generation
  • Hosting integrations (GitHub, GitLab, Bitbucket, SourceHut, Codeberg, and self-hosted)
Git Integration in Zed

For operations Zed does not support natively, use the integrated terminal.

Git Panel

The Git Panel is the hub for day-to-day version control. Open it with git panel: toggle focus from the Command Palette, or click the Git icon in the status bar.

In the panel you can see at a glance:

  • Active repository and branch
  • Changed files and their staging state
  • Commit message editor
  • Fetch, push, and pull controls (plus a remote selector when multiple remotes exist)

By default the panel docks on the left. Move it under Settings → Panels → Git Panel (dock left, right, or bottom). Switch between a flat file list and a folder tree via the panel context menu or the same settings page.

Git Status Indicators

Zed surfaces Git status throughout the interface so you always know what changed.

File Status in Project Panel

The project panel shows Git status for each file using color and symbols:

  • Green: New files (untracked)
  • Blue: Modified files
  • Red: Deleted files
  • Yellow: Renamed or moved files
  • Warning / conflict markers: Merge conflicts (also shown with a warning icon in the Git Panel)
Git Status Indicators

Status Bar Information

The status bar shows Git branch information and status:

  • Current branch name (click to open branch / Git actions)
  • Sync status (ahead / behind remote)
  • Shortcut into the Git Panel via the Git icon

Viewing Changes

Gutter Indicators

The editor gutter shows line-by-line change status:

  • Green bar: Added lines
  • Blue / accent bar: Modified lines
  • Red marker: Deleted lines

Hide gutter indicators in Settings → Version Control → Git Gutter (set Visibility to Hide).

Project Diff

Open all Git-tracked changes in one editable multibuffer with Project Diff (git: diff):

Action macOS Linux / Windows
Open Project Diff CtrlG then D CtrlG then D
Stage and next hunk Y AltY
Stage all CtrlY CtrlSpace
Expand all diff hunks " Ctrl"
Toggle selected hunks ' Ctrl'

Excerpts in Project Diff are real editors — you can edit them in place. Stage or unstage each hunk or whole file from the tab bar buttons or keybindings. Press Escape to collapse expanded hunks.

Diff View Styles

Diffs can be split (side-by-side, default) or unified (inline). Change this in Settings under “diff view style”, or in settings.json:

json
{ "diff_view_style": "unified" }

Word-level highlighting inside modified lines is on by default. Turn it off under Languages & Tools → Miscellaneous → Word Diff Enabled, or per language in settings.

Inline Diff and Navigation

  1. Open Diff View

    Use Project Diff, right-click a file in the Git Panel and choose Open Diff, or click a gutter indicator to inspect local hunks.

  2. Review Changes

    Review additions and deletions in split or unified mode. File History and Stash Diff use the same multibuffer-style diff views.

    Project Diff View
  3. Navigate Hunks

    Use editor: go to hunk and editor: go to previous hunk from the Command Palette (or your custom keybindings) to jump between changed regions.

Staging and Committing

Staging Workflows

Zed supports two primary staging workflows:

  • Project Diff: Focus each hunk and stage with git: stage and next, or stage everything with git: stage all, then commit.
  • Git Panel: Toggle each file’s checkbox, use Stage All at the top of the panel, or type a commit message and commit — Zed can auto-stage tracked files (shown with a [·] style checkbox) when you commit from the panel.

Right-click a changed file in the Git Panel for View File (open without diff) or Open Diff to review first.

Committing

Zed offers two commit text areas: the compact editor at the bottom of the Git Panel, and an expanded commit editor (git: expand commit editor, or ShiftEscape while focused in the panel commit box).

  1. Write a Message

    Focus the commit editor in the Git Panel. Zed wraps commit messages at 72 characters by default (configurable under Git Commit / preferred line length settings).

    Commit Editor
  2. Generate with AI (optional)

    With an LLM provider configured, run git: generate commit message, click the pencil icon in the commit editor, or use the shortcut below.

  3. Commit

    Press the commit shortcut or click Commit. A recent-commit bar appears under the textarea with an Uncommit action (git reset HEAD^ --soft) if you need to undo immediately.

Action macOS Linux / Windows
Commit Enter CtrlEnter
Generate commit message AltTab AltL
Expand commit editor ShiftEscape ShiftEscape
Toggle staged (panel) Space Space

Prefer a specific model for commit messages with agent.commit_message_model, and add instructions via agent.commit_message_instructions or your global AGENTS.md (~/.config/zed/AGENTS.md on macOS/Linux, %APPDATA%\Zed\AGENTS.md on Windows).

Fetch, Push, and Pull

Synchronize with remotes from the Git Panel buttons or the Command Palette (git: fetch, git: push, git: pull). With multiple remotes, use the remote selector next to push/pull.

Action macOS Linux / Windows
Push CtrlG then CtrlG then
Force push CtrlG then Shift CtrlG then Shift
Pull CtrlG then CtrlG then
Pull with rebase CtrlG then Shift CtrlG then Shift
Fetch CtrlG then CtrlG CtrlG then CtrlG

Push respects Git’s usual order: branch pushRemote, then remote.pushDefault, then the branch’s tracking remote — matching standard Git behavior.

Working with Branches

Viewing and Switching Branches

Create or switch branches with Command Palette actions:

  • git: branch — create a new branch
  • git: switch / git: checkout branch — switch to an existing branch
  • Click the branch name in the status bar for quick access

Creating New Branches

  1. Open Branch Actions

    Run git: branch from the Command Palette, or use the branch picker from the status bar.

  2. Name the Branch

    Enter a descriptive name for your new branch.

  3. Checkout

    Confirm to create and switch. Zed will update the panel and status bar to the new branch.

    Creating a New Branch

Deleting Branches

Open the branch switcher with git: switch, find the branch, and use the delete option. Zed confirms before deleting. You cannot delete the branch you currently have checked out — switch first.

Git Worktrees

Git worktrees let you keep multiple checkouts of the same repository on disk at once — useful for parallel branches or tasks without stashing or disturbing your main working tree.

Open the worktree picker from the title bar (next to the project picker) or run git: worktree:

  • Create a linked worktree from the current or default branch
  • Name it yourself or let Zed pick a name
  • Switch the current workspace to an existing worktree
  • Open a worktree in a new window
  • Delete linked worktrees that are not open
Action macOS Linux / Windows
Worktree picker CtrlW AltCtrlShiftW

New worktrees start in detached HEAD. After switching, use the branch picker to create or check out a branch. Configure the directory with git.worktree_directory (default: ../worktrees relative to the repo).

Handling Merge Conflicts

Identifying Conflicts

After a merge, rebase, or pull that conflicts:

  • Conflicted files appear in the Git Panel with a warning icon
  • Project Diff highlights each conflict region
  • Your branch’s changes are highlighted in green; incoming changes in blue

Resolving Conflicts

Each conflict shows resolution buttons above the region:

  1. Open the Conflicted File

    Open from the Git Panel or Project Diff to see conflict regions and in-editor controls.

  2. Choose a Resolution

    Use Use [your-branch], Use [other-branch], or Use Both (your changes first). For complex cases, edit the file directly and remove <<<<<<< / ======= / >>>>>>> markers.

    Merge Conflict Resolution
  3. Stage and Commit

    After resolving all conflicts in a file, stage it and commit to complete the merge.

Stashing

Stash temporarily saves uncommitted work and cleans the working directory — handy when you need to switch branches or pull without committing incomplete changes.

  • git: stash all — stash staged and unstaged changes
  • git: view stash — open the stash picker (also via Git Panel overflow menu)
  • git: stash apply / git: stash pop — apply latest (pop also removes it)

From the stash picker you can browse entries, open diffs, apply, pop, or drop stashes. In Stash Diff View:

Action macOS Linux / Windows
Open stash diff CtrlShiftV CtrlShiftV
Apply stash CtrlSpace CtrlSpace
Pop stash CtrlShiftSpace CtrlShiftSpace
Drop stash CtrlShiftBackspace CtrlShiftBackspace

Git History and Blame

File History

File History lists commits for a single file (author, timestamp, message). Selecting a commit opens a diff filtered to that file’s changes in that commit.

  • Right-click a file in the Project Panel, Git Panel, or an editor tab → View File History
  • Command Palette → search for “file history”

Git Blame

See who last modified each line:

  • Inline blame on the current line (configure delay or disable under Settings → Version Control → Inline Git Blame)
  • git: blame for a fuller blame view
Action macOS Linux / Windows
Git blame AltG then B AltG then B
Git Blame View

Permalinks and Hosting Integrations

Zed turns commit hashes and references to Issues, Pull Requests, and Merge Requests into clickable links for hosted GitHub, GitLab, Bitbucket, SourceHut, and Codeberg. Self-hosted instances are often detected from keywords in the remote URL; otherwise configure git_hosting_providers:

json
{ "git_hosting_providers": [ { "provider": "gitlab", "name": "Corp GitLab", "base_url": "https://git.example.corp" } ] }

Supported provider values include github, gitlab, bitbucket, gitea, forgejo, and sourcehut.

Copy Permalink

Share a permanent link to a line or range at a specific commit: select lines, right-click Copy Permalink, or run the permalink actions from the Command Palette (editor::CopyPermalinkToLine / editor::OpenPermalinkToLine).

Git Configuration in Zed

Settings Pages

Open Settings (, on macOS, Ctrl, on Linux/Windows). Git-related options live in two places:

  • Panels → Git Panel — dock position, tree vs flat view, status display
  • Version Control — gutter indicators, inline blame, hunk styles

Use Zed as Your Git Editor

To edit commit messages from the CLI in Zed:

shell
git config --global core.editor "zed --wait"

Or set export GIT_EDITOR="zed --wait" in your shell config.

Restore / Discard Changes

Action macOS Linux / Windows
Restore (discard hunk) AltZ CtrlK then CtrlR
Restore file Delete CtrlDelete

Zed respects your global Git configuration (.gitconfig) for identity, remotes, and authentication. Not every Git action has a default keybinding — bind extras in keymap.json (covered in the Keyboard Shortcuts tutorial).

What's Next?

Now that you can stage, commit, sync, resolve conflicts, and use worktrees from Zed, continue to Extensions to add languages, themes, MCP servers, and more.