🚧 Site under development

Back to tips

Git Integration Mastery

Leverage Zed's Git features to manage branches, view diffs, stage changes, and commit without leaving the editor

productivity
5 min read
intermediate · January 1, 2024
#git #version-control #integration

Zed’s Git integration allows you to manage version control without leaving your editor. Learn to use Git efficiently within your coding workflow.

Git Status Overview

View your repository status:

Cmd + Shift + G
# Open Git panel
 
Shows:
- Modified files
- Staged changes
- Branch information
- Commit history

Viewing Changes

Inline Diff Indicators

Zed shows Git changes in the gutter:

  • Green bar: Added lines
  • Blue bar: Modified lines
  • Red triangle: Deleted lines

File Diff View

Cmd + Shift + D
# Show diff for current file
 
Or click on file in Git panel

Staging Changes

Stage Individual Changes

1. Click the + next to modified lines
2. Or stage entire hunks
3. Use Cmd + K, G to open Git commands

Command Palette Git Actions

Cmd + Shift + P
Type: "git"
 
Common actions:
- Git: Stage File
- Git: Unstage File
- Git: Stage All
- Git: Discard Changes

Committing

Quick Commit

Cmd + Enter
# Commit staged changes
 
1. Write commit message
2. Press Cmd + Enter to commit
3. Or Esc to cancel

Commit Message Best Practices

feat: Add user authentication
^    ^
|    |
|    +-> Summary (imperative, lowercase)
+-------> Type (feat, fix, docs, style, refactor, test, chore)
 
Optional body explaining the change in detail

Branch Management

Switch Branches

Cmd + K, B
# Quick branch switcher
 
Or:
Cmd + Shift + P → "git: switch branch"

Create New Branch

Cmd + Shift + P → "git: create branch"
Enter branch name

Git History

View Commit History

Open Git panel
Click "History" tab
Browse commits
Click to see changes

Blame View

See who changed each line:

Cmd + Shift + P → "git: toggle blame"
Shows author and commit for each line

Merge Conflicts

Conflict Resolution

When conflicts occur:

1. Open conflicted file
2. Zed highlights conflicts
3. Choose: Accept Current | Accept Incoming | Accept Both
4. Or manually edit
5. Stage resolved file

Pro Tips

  • Amend commits: git commit --amend via command palette
  • Stash changes: Quickly save work in progress
  • Cherry-pick: Apply specific commits from other branches
  • Interactive rebase: Clean up commit history before pushing
  • Git blame in hover: See commit info on hover
  • Set up commit message templates in Git config
  • Use semantic commit messages for better history

What's next?

Continue your Zed mastery journey

Next Tip

Smart Code Navigation

Learn powerful navigation techniques to jump between files, symbols, and definitions instantly.

beginner 5 min read

Browse

All Tips

Explore the complete collection

Contribute

Share a Tip

Help grow the community

Improve

Report Issue

Found something wrong?