Warp,智能终端
Available for MacOS and Linux
适用于 MacOS 和 Linux
我和 Jesse 共同创立了 Subble,旨在帮助您的公司节省时间和金钱,通过管理其软件订阅。了解更多!
Maintenance of this project is made possible by all the contributors and sponsors. If you'd like to sponsor this project and have your avatar or company logo appear below click here. 💙
该项目的维护得益于所有贡献者和赞助者的支持。如果您想赞助该项目,并希望您的头像或公司标志出现在下方,请点击这里。💖
Rant time: You've heard it before, git is powerful, but what good is that power when everything is so damn hard to do? Interactive rebasing requires you to edit a goddamn TODO file in your editor? Are you kidding me? To stage part of a file you need to use a command line program to step through each hunk and if a hunk can't be split down any further but contains code you don't want to stage, you have to edit an arcane patch file by hand? Are you KIDDING me?! Sometimes you get asked to stash your changes when switching branches only to realise that after you switch and unstash that there weren't even any conflicts and it would have been fine to just checkout the branch directly? YOU HAVE GOT TO BE KIDDING ME!
吐槽时间:你肯定听过,git 很强大,但这种强大有什么用,当一切操作都如此难的时候?交互式重基需要你在编辑器中编辑一个该死的 TODO 文件?你在开玩笑吗?要暂存文件的一部分,你需要使用命令行程序逐个处理每个块,如果一个块不能再分割,但包含你不想要暂存的代码,你只能手动编辑一个晦涩的补丁文件?你在逗我吗?有时候你被要求在切换分支时暂存更改,结果切换分支并恢复后发现根本没有冲突,直接切换分支就好了?你一定是在逗我!
If you're a mere mortal like me and you're tired of hearing how powerful git is when in your daily life it's a powerful pain in your ass, lazygit might be for you.
如果你像我一样只是一个普通人,每天使用 git 时发现它虽然强大却常常给你带来麻烦,那么 lazygit 可能会适合你。
- Sponsors 赞助者
- Elevator Pitch 电梯演讲
- Table of contents 目录
- Features 功能
- Stage individual lines 单独阶段化行
- Interactive Rebase 交互式重排
- Cherry-pick 选择性应用
- Bisect 二分查找
- Nuke the working tree
清空工作目录 - Amend an old commit
修改旧提交 - Filter 筛选
- Invoke a custom command
调用自定义命令 - Worktrees 工作树
- Rebase magic (custom patches)
重置魔法(自定义补丁) - Rebase from marked base commit
从标记的基础提交进行重置 - Undo 撤销
- Commit graph 提交图
- Compare two commits 比较两个提交
- Tutorials 教程
- Installation 安装
- Binary Releases 二进制发布
- Homebrew
- MacPorts
- Void Linux
- Scoop (Windows)
- Arch Linux
- Fedora and RHEL Fedora 和 RHEL
- Solus Linux
- Debian and Ubuntu Debian 和 Ubuntu
- Funtoo Linux
- Gentoo Linux
- FreeBSD
- Termux
- Conda
- Go
- Chocolatey (Windows) Chocolatey(Windows)
- Winget (Windows 10 1709 or later)
Winget(Windows 10 1709 及以上版本) - Manual 手动
- Usage 使用方法
- Configuration 配置
- Contributing 贡献指南
- Donate 捐赠
- FAQ
- Shameless Plug 无耻的宣传
- Alternatives 替代方案
Lazygit is not my fulltime job but it is a hefty part time job so if you want to support the project please consider sponsoring me
Lazygit 并不是我的全职工作,但它是一项重要的兼职工作,所以如果你想要支持这个项目,请考虑赞助我
Press space on the selected line to stage it, or press v to start selecting a range of lines. You can also press a to select the entirety of the current hunk.
在选中的行上按下空格键可以暂存该行,或者按下 v 可以开始选择一系列行。你也可以按下 a 选择当前块的所有内容。
Interactive Rebase 重试 错误原因
Press i to start an interactive rebase. Then squash (s), fixup (f), drop (d), edit (e), move up (ctrl+k) or move down (ctrl+j) any of TODO commits, before continuing the rebase by bringing up the rebase options menu with m and then selecting continue.
重试
错误原因
You can also perform any these actions as a once-off (e.g. pressing s on a commit to squash it) without explicitly starting a rebase.
重试
错误原因
This demo also uses shift+down to select a range of commits to move and fixup.
这个示例还使用 shift+down 选择一系列提交进行移动和修复。
Press shift+c on a commit to copy it and press shift+v to paste (cherry-pick) it.
在提交上按 shift+c 复制它,然后按 shift+v 粘贴(cherry-pick)。
Press b in the commits view to mark a commit as good/bad in order to begin a git bisect.
重试
错误原因
For when you really want to just get rid of anything that shows up when you run git status (and yes that includes dirty submodules) kidpix style, press shift+d to bring up the reset options menu and then select the 'nuke' option.
当你真的想清除运行 git status 时显示的所有内容(包括未清理的子模块)时,可以按下 shift+d 弹出重置选项菜单,然后选择“清空”选项。
Pressing shift+a on any commit will amend that commit with the currently staged changes (running an interactive rebase in the background).
按下 shift+a 可以将当前已暂存的更改合并到任意提交中(后台运行交互式重基操作)。
You can filter a view with /. Here we filter down our branches view and then hit enter to view its commits.
你可以使用 / 进行过滤。在这里,我们将分支视图进行过滤,然后按下 enter 查看其提交记录。
Lazygit has a very flexible custom command system. In this example a custom command is defined which emulates the built-in branch checkout action.
Lazygit 具有非常灵活的自定义命令系统。在这个示例中,定义了一个自定义命令,该命令模拟了内置分支切换操作。
You can create worktrees to have multiple branches going at once without the need for stashing or creating WIP commits when switching between them. Press w in the branches view to create a worktree from the selected branch and switch to it.
你可以创建 worktrees,在切换分支时无需 stash 或创建 WIP 提交即可同时处理多个分支。在分支视图中按下 w 即可从选定的分支创建 worktree 并切换到该分支。
You can build a custom patch from an old commit and then remove the patch from the commit, split out a new commit, apply the patch in reverse to the index, and more.
你可以从一个旧提交构建一个自定义补丁,然后从提交中移除该补丁,拆分出一个新的提交,将补丁反向应用到索引中,等等。
In this example we have a redundant comment that we want to remove from an old commit. We hit <enter> on the commit to view its files, then <enter> on a file to focus the patch, then <space> to add the comment line to our custom patch, and then ctrl+p to view the custom patch options; selecting to remove the patch from the current commit.
在本示例中,我们有一个多余的注释,想要从一个旧提交中移除。我们按下 <enter> 查看提交的文件,然后按下 <enter> 选择一个文件来聚焦补丁,接着按下 <space> 将注释行添加到自定义补丁中,然后按下 ctrl+p 查看自定义补丁选项;选择从当前提交中移除该补丁。
Learn more in the Rebase magic Youtube tutorial.
了解更多关于重 base 魔法的 YouTube 教程。
Say you're on a feature branch that was itself branched off of the develop branch, and you've decided you'd rather be branching off the master branch. You need a way to rebase only the commits from your feature branch. In this demo we check to see which was the last commit on the develop branch, then press shift+b to mark that commit as our base commit, then press r on the master branch to rebase onto it, only bringing across the commits from our feature branch. Then we push our changes with shift+p.
在你处于一个特性分支上时,这个特性分支又是从 develop 分支派生出来的,而你决定改为从 master 分支进行分支。你需要一种方法来仅重新应用特性分支中的提交。在本演示中,我们首先检查 develop 分支的最后一个提交,然后按下 shift+b 标记该提交作为基点,接着在 master 分支上按下 r 来重新应用到该基点,仅带来特性分支中的提交。然后我们使用 shift+p 推送更改。
You can undo the last action by pressing z and redo with ctrl+z. Here we drop a couple of commits and then undo the actions.
Undo uses the reflog which is specific to commits and branches so we can't undo changes to the working tree or stash.
您可以按 z 撤销上一个操作,按 ctrl+z 重新执行。这里我们丢弃了几条提交,然后撤销了这些操作。撤销使用的是 reflog,这是针对提交和分支的,因此我们无法撤销工作树中的更改或 stash。
When viewing the commit graph in an enlarged window (use + and _ to cycle screen modes), the commit graph is shown. Colours correspond to the commit authors, and as you navigate down the graph, the parent commits of the selected commit are highlighted.
在放大窗口中查看提交图(使用 + 和 _ 切换屏幕模式时),将显示提交图。颜色对应于提交作者,当你在图中导航时,所选提交的父提交将被高亮显示。
If you press shift+w on a commit (or branch/ref) a menu will open that allows you to mark that commit so that any other commit you select will be diffed against it. Once you've selected the second commit, you'll see the diff in the main view and if you press <enter> you'll see the files of the diff. You can press shift+w to view the diff menu again to see options like reversing the diff direction or exiting diff mode. You can also exit diff mode by pressing <escape>.
如果你在某个提交(或分支/引用)上按下 shift+w ,将会弹出一个菜单,允许你标记该提交,以便在选择另一个提交时将其与该提交进行比较。一旦你选择了第二个提交,你将在主视图中看到差异,并且按下 <enter> 可以查看差异的文件。你可以按下 shift+w 再次查看差异菜单,以查看如反转差异方向或退出差异模式等选项。你也可以通过按下 <escape> 退出差异模式。
- 15 Lazygit Features in 15 Minutes
15 分钟掌握 Lazygit 的 15 个功能 - Basics Tutorial 基础教程
- Rebase Magic Tutorial 合并魔力教程
Most of the above packages are maintained by third parties so be sure to vet them yourself and confirm that the maintainer is a trustworthy looking person who attends local sports games and gives back to their communities with barbeque fundraisers etc
大多数上述软件包由第三方维护,因此请务必自行核实,并确认维护者是一个看起来值得信赖的人,他们参加当地的体育赛事,并通过烧烤筹款等活动回馈社区
Binary Releases 重试 错误原因
For Windows, Mac OS(10.12+) or Linux, you can download a binary release here. 重试 错误原因
Homebrew 重试 错误原因
It works with Linux, too.
它同样适用于 Linux。
brew install lazygitLatest version built from github releases.
Tap:
最新版本是从 github 发布构建的。Tap:
sudo port install lazygit
Packages for Void Linux are available in the distro repo
Void Linux 的软件包在发行版仓库中可用
They follow upstream latest releases 重试 错误原因
sudo xbps-install -S lazygitYou can install lazygit using scoop. It's in the extras bucket:
你可以使用 scoop 安装 lazygit 。它在 extras 桶中:
# Add the extras bucket
scoop bucket add extras
# Install lazygit
scoop install lazygitPackages for Arch Linux are available via pacman and AUR (Arch User Repository).
Arch Linux 的软件包可以通过 pacman 和 AUR(Arch User Repository)获取。
There are two packages. The stable one which is built with the latest release
and the git version which builds from the most recent commit.
有两个软件包。一个是基于最新发布版本的稳定版本,另一个是基于最近提交的 git 版本。
- Stable:
sudo pacman -S lazygit稳定版:sudo pacman -S lazygit - Development: https://aur.archlinux.org/packages/lazygit-git/
开发版: https://aur.archlinux.org/packages/lazygit-git/
Instruction of how to install AUR content can be found here:
https://wiki.archlinux.org/index.php/Arch_User_Repository
如何安装 AUR 内容的说明可以在以下链接找到:https://wiki.archlinux.org/index.php/Arch_User_Repository
Packages for Fedora, Amazon Linux 2023 and CentOS Stream are available via
Copr (Cool Other Package Repo).
适用于 Fedora、Amazon Linux 2023 和 CentOS Stream 的包可以通过 Copr(Cool Other Package Repo)获取。
sudo dnf copr enable dejan/lazygit
sudo dnf install lazygitThese packages are built using the RPM spec file located here: https://codeberg.org/dejan/rpm-lazygit
这些包是使用这里提供的 RPM spec 文件构建的:https://codeberg.org/dejan/rpm-lazygit
You should be able to build RPMs for Fedora 41 or older, and other Fedora derivatives using the
SRPM (Source RPM) file that you can grab from the latest COPR build.
你应该能够使用从最新 COPR 构建中获取的 SRPM(源 RPM)文件为 Fedora 41 或更早版本以及其他 Fedora 衍生版本构建 RPM 包。
sudo eopkg install lazygitFor Debian 13 "Trixie", Sid, and later, or Ubuntu 25.10 "Questing Quokka" and later:
对于 Debian 13 "Trixie"、Sid 及更晚版本,或 Ubuntu 25.10 "Questing Quokka" 及更晚版本:
sudo apt install lazygitFor Debian 12 "Bookworm", Ubuntu 25.04 "Plucky Puffin" and earlier:
对于 Debian 12 "Bookworm"、Ubuntu 25.04 "Plucky Puffin" 及更早版本:
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | \grep -Po '"tag_name": *"v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/download/v${LAZYGIT_VERSION}/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit -D -t /usr/local/bin/Verify the correct installation of lazygit:
验证 lazygit 的正确安装:
lazygit --versionFuntoo Linux has an autogenerated lazygit package in dev-kit:
Funtoo Linux 有一个由系统自动生成的 lazygit 包在 dev-kit 中:
sudo emerge dev-vcs/lazygitLazygit is not (yet) in main Gentoo portage, however an ebuild is available in GURU overlay
Lazygit 尚未(还未)在 Gentoo 主端口(portage)中,但是 GURU 覆盖(overlay)中有一个 ebuild
You can either add the overlay to your system and install lazygit as usual:
你可以将覆盖层添加到你的系统中,然后像往常一样安装 lazygit:
sudo eselect repository enable guru
sudo emaint sync -r guru
sudo emerge dev-vcs/lazygitThe lazygit package is currently built in devel:languages:go/lazygit.
lazygit 包当前在 devel:languages:go/lazygit 中构建。
To install lazygit on openSUSE Tumbleweed run:
要在 openSUSE Tumbleweed 上安装 lazygit,请运行:
sudo zypper ar https://download.opensuse.org/repositories/devel:/languages:/go/openSUSE_Factory/devel:languages:go.repo
sudo zypper ref && sudo zypper in lazygitTo install lazygit on openSUSE Leap run:
要在 openSUSE Leap 上安装 lazygit,请运行:
source /etc/os-release
sudo zypper ar https://download.opensuse.org/repositories/devel:/languages:/go/$VERSION_ID/devel:languages:go.repo
sudo zypper ref && sudo zypper in lazygitOn NixOs lazygit is packaged with nix and distributed via nixpkgs.
You can try the lazygit without installing it with:
在 NixOs 中,lazygit 会与 nix 一起打包并通过 nixpkgs 分发。你可以通过以下命令尝试使用 lazygit 而无需安装:
nix-shell -p lazygit
# or with flakes enabled
nix run nixpkgs#lazygitOr you can add lazygit to you configuration.nix using the environment.systemPackages option.
More details can be found via NixOs search page.
或者你可以使用 configuration.nix 选项将 lazygit 添加到你的 environment.systemPackages 中。更多详细信息可以在 NixOs 搜索页面找到。
Lazygit can be installed into a Flox environment as follows.
Lazygit 可以安装到 Flox 环境中,具体操作如下。
flox install lazygitMore details about Flox can be found on their website.
更多关于 Flox 的详细信息可以在其网站上找到。
pkg install lazygitapt install lazygitReleased versions are available for different platforms, see https://anaconda.org/conda-forge/lazygit
已发布的版本可在不同平台获取,请参见 https://anaconda.org/conda-forge/lazygit
conda install -c conda-forge lazygitgo install github.com/jesseduffield/lazygit@latestPlease note:
If you get an error claiming that lazygit cannot be found or is not defined, you
may need to add ~/go/bin to your $PATH (MacOS/Linux), or %HOME%\go\bin
(Windows). Not to be mistaken for C:\Go\bin (which is for Go's own binaries,
not apps like lazygit).
请注意:如果您遇到 lazygit 未找到或未定义的错误,请尝试在 $PATH 中添加 ~/go/bin (MacOS/Linux),或 %HOME%\go\bin (Windows)。这与 C:\Go\bin (Go 自身的二进制文件所用,而不是像 lazygit 这样的应用程序)不同。
You can install lazygit using Chocolatey:
你可以使用 Chocolatey 安装 lazygit :
choco install lazygitYou can install lazygit using the winget command in the Windows Terminal with the following command:
你可以在 Windows 终端中使用 winget 命令安装 lazygit :
winget install -e --id=JesseDuffield.lazygitYou'll need to install Go
你需要安装 Go
git clone https://github.com/jesseduffield/lazygit.git
cd lazygit
go install
You can also use go run main.go to compile and run in one go (pun definitely intended)
你也可以使用 go run main.go 一次性编译并运行(双关无疑)
Call lazygit in your terminal inside a git repository.
在 Git 仓库的终端中调用 lazygit 。
$ lazygitIf you want, you can
also add an alias for this with echo "alias lg='lazygit'" >> ~/.zshrc (or
whichever rc file you're using).
如果你想的话,你也可以通过 echo "alias lg='lazygit'" >> ~/.zshrc (或你正在使用的任何其他 rc 文件)添加一个别名。
You can check out the list of keybindings here.
你可以在这里查看快捷键列表。
If you change repos in lazygit and want your shell to change directory into that repo on exiting lazygit, add this to your ~/.zshrc (or other rc file):
如果你在 lazygit 中切换了仓库,并希望退出 lazygit 时 shell 也切换到该仓库目录,可以在你的 ~/.zshrc (或其他 rc 文件)中添加以下内容:
lg()
{
export LAZYGIT_NEW_DIR_FILE=~/.lazygit/newdir
lazygit "$@"
if [ -f $LAZYGIT_NEW_DIR_FILE ]; then
cd "$(cat $LAZYGIT_NEW_DIR_FILE)"
rm -f $LAZYGIT_NEW_DIR_FILE > /dev/null
fi
}
Then source ~/.zshrc and from now on when you call lg and exit you'll switch directories to whatever you were in inside lazygit. To override this behaviour you can exit using shift+Q rather than just q.
这样,从现在起当你调用 lg 并退出时,会切换到你在 lazygit 内部所在的目录。如果你想覆盖这种行为,可以在退出时使用 shift+Q 而不是仅仅使用 q 。
See the docs 查看文档
Check out the configuration docs.
查看配置文档。
See the docs 查看文档
If lazygit is missing a feature, there's a good chance you can implement it yourself with a custom command!
如果 lazygit 缺少某个功能,有很大可能是你可以通过自定义命令来实现它!
See the docs 查看文档
Lazygit supports Gitflow if you have it installed. To understand how the Gitflow model works check out Vincent Driessen's original post explaining it. To view Gitflow options from within Lazygit, press i from within the branches view.
Lazygit 支持 Gitflow,前提是您已经安装了 Gitflow。要了解 Gitflow 模型的工作原理,请参阅 Vincent Driessen 的原始文章,其中解释了该模型。要在 Lazygit 中查看 Gitflow 选项,请在分支视图中按 i 。
We love your input! Please check out the contributing guide.
For contributor discussion about things not better discussed here in the repo, join the discord channel
我们非常欢迎您的输入!请查阅贡献指南。对于不适合在此仓库中讨论的贡献者讨论,请加入 Discord 频道。
Check out this video walking through the creation of a small feature in lazygit if you want an idea of where to get started.
查看这个视频,了解如何在 lazygit 中创建一个小功能,这将帮助你了解从何处开始。
Run lazygit --debug in one terminal tab and lazygit --logs in another to view the program and its log output side by side
在一个终端标签页中运行 lazygit --debug ,在另一个标签页中运行 lazygit --logs ,以并排查看程序及其日志输出
If you would like to support the development of lazygit, consider sponsoring me (github is matching all donations dollar-for-dollar for 12 months)
如果您想支持 lazygit 的开发,可以考虑赞助我(GitHub 会逐美元匹配匹配捐赠金额进行 1 1 至 11 12 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 个月)
- Green: the commit is included in the master branch
绿色:表示提交的 master 分支 是 master 主 分支 - Yellow: the commit is not included in the master branch
黄色:该提交未包含在 master 分支中 - Red: the commit has not been pushed to the upstream branch
红色:该提交尚未推送到上游分支
If you want to see what I (Jesse) am up to in terms of development, follow me on
twitter or check out my blog
如果你想了解我在开发方面的最新动态,可以关注我的 Twitter 或访问我的博客
If you find that lazygit doesn't quite satisfy your requirements, these may be a better fit:
如果你发现 lazygit 不能完全满足你的需求,以下这些可能更适合你:





















































































































