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 historyViewing 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 panelStaging Changes
Stage Individual Changes
1. Click the + next to modified lines
2. Or stage entire hunks
3. Use Cmd + K, G to open Git commandsCommand Palette Git Actions
Cmd + Shift + P
Type: "git"
Common actions:
- Git: Stage File
- Git: Unstage File
- Git: Stage All
- Git: Discard ChangesCommitting
Quick Commit
Cmd + Enter
# Commit staged changes
1. Write commit message
2. Press Cmd + Enter to commit
3. Or Esc to cancelCommit Message Best Practices
feat: Add user authentication
^ ^
| |
| +-> Summary (imperative, lowercase)
+-------> Type (feat, fix, docs, style, refactor, test, chore)
Optional body explaining the change in detailBranch 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 nameGit History
View Commit History
Open Git panel
Click "History" tab
Browse commits
Click to see changesBlame View
See who changed each line:
Cmd + Shift + P → "git: toggle blame"
Shows author and commit for each lineMerge 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 filePro Tips
- Amend commits:
git commit --amendvia 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