the IT Hustle
工具实战手册关于
Productivity ToolsAI辅助2026-04-02•12 min 阅读

lazygit: Stop Memorizing Git Commands and Use This Instead

作者: Salty Deprecated Software Engineer

✨ AI 辅助内容

本文由 AI 辅助创作,并经团队审核以确保准确性和质量。所有技术信息和示例均已验证。

I've been using git for over a decade and I still Google "git undo last commit" at least once a month. I know the DAG. I understand the reflog. And yet, staring at a terminal wondering if git rebase -i HEAD~3 is about to destroy my afternoon is a universal developer experience.

lazygit makes git visual.It's a terminal UI (TUI) that shows you branches, commits, staged files, and diffs — all in one screen. You navigate with arrow keys and single-letter commands instead of memorizing flags.

It has over 53,000 GitHub stars, and developers who try it tend to never go back. Here's why.

What Is lazygit?

lazygit is a free, open-source terminal application written in Go that gives you a visual interface for git. Instead of typing commands, you see panels showing:

  • Files panel — what's modified, staged, and untracked
  • Branches panel — local and remote branches, with merge status
  • Commits panel — your commit history with diffs
  • Stash panel — saved work-in-progress

You press space to stage a file. c to commit. p to push. z to undo. No flags. No manual pages. No "wait, was it --hard or --soft?"

The 6 Things lazygit Does Better Than Raw Git

1. Staging Individual Lines (Not Just Files)

You changed 50 lines in a file but only want to commit 10 of them. In raw git, that's git add -p followed by an arcane y/n/s/e interface.

In lazygit, you see the diff, highlight the lines you want, and press space. Done. You can stage individual lines, hunks, or entire files with the same keypress.

2. Interactive Rebase Without the Pain

Interactive rebase is one of the most powerful git features and one of the most terrifying. In raw git:

Raw git:

git rebase -i HEAD~5

# Opens a text file with pick/squash/fixup/drop commands

# Edit the file, save, close, pray

lazygit:

Navigate to a commit → press 's' to squash, 'f' to fixup, 'd' to drop

# See results instantly. Press 'z' to undo if wrong.

3. Merge Conflict Resolution You Can Actually See

Merge conflicts in the terminal are a wall of <<<<<<< and >>>>>>>markers. lazygit shows you both versions side by side and lets you pick which one to keep with a single keypress. For each conflict section, press the left arrow for "ours" or right arrow for "theirs."

4. Undo Anything with 'z'

lazygit has a built-in undo/redo system that uses the git reflog under the hood. Dropped a commit by accident? Press z. Force-pushed the wrong branch? Press z. It's the Ctrl+Z that git never gave you.

5. Cherry-Pick by Dragging

Need to pull a specific commit from one branch to another? In lazygit, navigate to the commit, press c to copy, switch to the target branch, and press vto paste. It's cherry-pick without remembering the syntax.

6. Worktrees (Multiple Branches at Once)

Need to work on two branches simultaneously without stashing? Press w in the branches view to create a worktree. lazygit opens a separate working copy of your repo on the other branch. No stashing, no WIP commits, no context-switching headaches.

How to Install It

macOS (Homebrew):

brew install lazygit

Ubuntu/Debian:

sudo add-apt-repository ppa:lazygit-team/release
sudo apt update && sudo apt install lazygit

Windows (Scoop):

scoop install lazygit

Then just run:

lazygit

# Run from any git repository. That's it.

The Essential Keyboard Shortcuts

KeyActionGit equivalent
spaceStage/unstage filegit add / git reset
cCommitgit commit
p / PPush / Pullgit push / git pull
sSquash commitgit rebase -i (squash)
zUndogit reflog + reset
nNew branchgit checkout -b
?Help (show all keys)man git

lazygit vs. Other Git UIs

There are plenty of git GUIs — GitKraken, SourceTree, GitHub Desktop, Tower. So why a terminal-based tool?

  • Speed. lazygit opens instantly. No Electron app boot time. No loading spinners.
  • Works over SSH. If you're on a remote server, you can't run GitKraken. lazygit works anywhere you have a terminal.
  • Free forever. No paid tiers. No feature gating. Open source under MIT license.
  • Keyboard-first. Once you learn the shortcuts (a few hours), you're faster than any mouse-based GUI.

The trade-off is the learning curve of a TUI. If you've never used a terminal app with panels before, the first 15 minutes feel unfamiliar. After that, it clicks.

Who Should Use lazygit?

  • Developers who live in the terminal — if you already use vim, tmux, or any CLI tools, lazygit fits right in.
  • Anyone who avoids rebase and cherry-pick — these are powerful git operations that most people skip because the syntax is scary. lazygit makes them one-key operations.
  • Teams reviewing code locally — you can browse branches, read diffs, and navigate commit history faster than in a web UI.
  • Anyone who's ever lost work to a bad git command — the undo feature alone is worth the install.

The Bottom Line

Git is one of those tools that punishes you for not memorizing it. lazygit removes that punishment. You still get the full power of git — staging, branching, rebasing, cherry-picking, worktrees — but with a visual interface that shows you what's happening instead of making you guess.

Install it. Run lazygit in any repo. Spend 15 minutes with the ? help screen. You'll wonder why you ever typed git log --oneline --graph --all by hand.

Get lazygit: github.com/jesseduffield/lazygit (free, open source)

Love terminal tools? Check out our 10 Command Line Tools That Will 10x Your Productivity and our free .gitignore Generator.

IT
Salty Deprecated Software Engineer

以 The IT Hustle 的编辑笔名写作——25 年以上笔记本维修技师、系统管理员、存储工程师和软件工程师的经验,如今用在 AI 智能体运维上。每篇文章发布前都经过人工审核,详见编辑准则。

我们的工具全部文章关于我们

获取最新资讯

第一时间了解新工具、博客文章和更新动态。无垃圾邮件。

生成专属防幻觉提示词

AI 提示词引擎采用专有技术,生成内置验证和矛盾测试的提示词。

免费试用 3 次 →

公司

  • 关于
  • 实战手册
  • AI 术语表
  • 关于作者
  • 联系我们

产品

  • 工具
  • 价格观察
  • 智能体运维
  • 编程
  • 设计
  • 运维
  • 效率
  • 营销
  • 商务

法律信息

  • 隐私政策
  • 服务条款
  • 免责声明
  • 编辑准则
  • 更正说明

© 2026 Salty Rantz LLC. 版权所有。

为在技术变革中前行的职场人打造。