How jesseduffield/lazygit works
Lazygit is a terminal UI for operating on Git repositories. The user starts the app, navigates repository views, and invokes Git actions through context-specific controllers; those actions use Git command services, while results are presented in the UI. The tree and excerpts identify core areas for commits, files, branches, remotes, stashes, worktrees, conflict handling, custom commands, and background tasks. Some subsystem links are based on the SOURCE INDEX or README; unsampled implementations are represented at their supported directory paths, not treated as inspected.
Main entry points: controllers.go UI controllers · git_commands Git command services · app.go App bootstrap · gui.go Terminal UI
Components 21
Startup and configuration
- App bootstrap
pkg/app/app.go - User configuration
pkg/config
UI and interaction
- Terminal UI
pkg/gui/gui.go - UI controllers
pkg/gui/controllers.go - Branch actions
pkg/gui/controllers/branches_controller.go - File and diff actions
pkg/gui/controllers/files_controller.go - Commit history actions
pkg/gui/controllers/local_commits_controller.go - Diff navigation
pkg/gui/controllers/main_view_controller.go - View contexts
pkg/gui/context - Repository presentation
pkg/gui/presentation - Custom commands
pkg/gui/services/custom_commands/handler_creator.go
Git operations
- Git command services
pkg/commands/git_commands - Process execution
pkg/commands/oscommands - Git data models
pkg/commands/models - Hosting integration
pkg/commands/hosting_service/hosting_service.go
Runtime support
- Async tasks
pkg/tasks/tasks.go - UI task adapter
pkg/gui/tasks_adapter.go - Update checking
pkg/updates/updates.go
Other components
- Terminal user
- Git repository
- Hosting provider
Connections 25
- Terminal user → App bootstrap: starts
README.md - App bootstrap → Terminal UI: runs
pkg/app/app.go - App bootstrap → User configuration: loads
pkg/app/app.go - App bootstrap → Git command services: initializes
pkg/app/app.go - App bootstrap → Update checking: creates updater
pkg/app/app.go - Terminal user → Terminal UI: interacts
- Terminal UI → UI controllers: attaches
pkg/gui/controllers.go - UI controllers → Branch actions: registers
pkg/gui/controllers.go - UI controllers → File and diff actions: registers
pkg/gui/controllers.go - UI controllers → Commit history actions: registers
pkg/gui/controllers.go - UI controllers → Diff navigation: registers
pkg/gui/controllers.go - UI controllers → Custom commands: configures
pkg/gui/controllers.go - Branch actions → Git command services: invokes
pkg/gui/controllers/branches_controller.go - File and diff actions → Git command services: invokes
pkg/gui/controllers/files_controller.go - Commit history actions → Git command services: invokes
pkg/gui/controllers/local_commits_controller.go - File and diff actions → Git data models: uses
pkg/gui/controllers/files_controller.go - Branch actions → Git data models: uses
pkg/gui/controllers/branches_controller.go - Commit history actions → View contexts: operates on
pkg/gui/controllers/local_commits_controller.go - Diff navigation → View contexts: navigates
pkg/gui/controllers/main_view_controller.go - Git command services → Process execution: executes via
- Process execution → Git repository: runs Git against
- Git command services → Hosting integration: delegates hosting
pkg/commands/git_commands/hosting_service.go - Hosting integration → Hosting provider: connects
- UI task adapter → Async tasks: adapts
pkg/gui/tasks_adapter.go - Terminal UI → Repository presentation: renders