lazygit

lazygit

终端界面优化Git命令操作

lazygit为Git命令提供直观的终端操作界面,简化代码仓库管理、提交更改和推送流程。支持多平台,具有活跃社区和持续更新。适合各级开发者使用,有效提升Git工作效率。

lazygitGit终端界面开源项目版本控制Github
<div align="center"> <sup>特别鸣谢:</sup> <br> <br> <a href="https://www.warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=lazygit_20231023"> <div> <img src="https://raw.githubusercontent.com/jesseduffield/lazygit/master/.assets/warp.png" width="230" alt="Warp"> </div> <b>Warp 是一款基于 Rust 的现代终端,内置 AI 功能,帮助您和您的团队更快地构建优秀软件。</b> <div> <sup>访问 warp.dev 了解更多信息。</sup> </div> </a> <br> <hr> <a href="https://www.subble.com"> <div> <img src="https://yellow-cdn.veclightyear.com/835a84d5/7fcad735-1b28-48c3-b695-bde5888eae75.svg" width="230" alt="Subble"> </div> <b>我(Jesse)共同创立了 Subble,通过帮助您管理公司的软件订阅来节省时间和金钱。欢迎了解!</b> </a> <br> <hr> </div> <p align="center"> <img width="536" src="https://yellow-cdn.veclightyear.com/835a84d5/8c4fe6fc-1ea8-43a4-b19a-530bc34c3245.png"> </p> <div align="center">

一个简单的 git 命令终端用户界面 <br/>

GitHub Releases Go Report Card Codacy Badge Codacy Badge GolangCI GitHub tag homebrew

commit_and_push

</div>

赞助商

<p align="center"> 本项目的维护得益于所有<a href="https://github.com/jesseduffield/lazygit/graphs/contributors">贡献者</a>和<a href="https://github.com/sponsors/jesseduffield">赞助商</a>的支持。如果您想赞助本项目并在下方显示您的头像或公司标志,请<a href="https://github.com/sponsors/jesseduffield">点击这里</a>。💙 </p> <p align="center"> <!-- 赞助商 --><a href="https://github.com/intabulas"><img src="https://yellow-cdn.veclightyear.com/835a84d5/b6c74fc7-9369-40dc-a357-90a2eb38d241.png" width="60px" alt="Mark Lussier" /></a><a href="https://github.com/peppy"><img src="https://yellow-cdn.veclightyear.com/835a84d5/c51da35d-1530-454c-8190-9868597ef128.png" width="60px" alt="Dean Herbert" /></a><a href="https://github.com/piot"><img src="https://yellow-cdn.veclightyear.com/835a84d5/4c92788b-30de-4ddd-a1c5-54e0839eda5b.png" width="60px" alt="Peter Bjorklund" /></a><a href="https://github.com/rgwood"><img src="https://yellow-cdn.veclightyear.com/835a84d5/d0a07c8b-0359-4a1d-bc50-70803fcc1d3d.png" width="60px" alt="Reilly Wood" /></a><a href="https://github.com/oliverguenther"><img src="https://yellow-cdn.veclightyear.com/835a84d5/c5e12e12-ec3b-44e7-9eb0-fd7cbe9e55b9.png" width="60px" alt="Oliver Günther" /></a><a href="https://github.com/pawanjay176"><img src="https://yellow-cdn.veclightyear.com/835a84d5/4a71ac8b-74c1-42c6-90c5-334e05fcebb7.png" width="60px" alt="Pawan Dhananjay" /></a><a href="https://github.com/bdach"><img src="https://yellow-cdn.veclightyear.com/835a84d5/fcd47971-ad91-4756-8814-488330deda4a.png" width="60px" alt="Bartłomiej Dach" /></a><a href="https://github.com/carstengehling"><img src="https://yellow-cdn.veclightyear.com/835a84d5/277230c8-9c2f-4d35-b9be-e0ec5681d1a9.png" width="60px" alt="Carsten Gehling" /></a><a href="https://github.com/ceuk"><img src="https://yellow-cdn.veclightyear.com/835a84d5/6fab6d4b-ca01-4116-addf-fba4901a62a3.png" width="60px" alt="CEUK" /></a><a href="https://github.com/akospwc"><img src="https://yellow-cdn.veclightyear.com/835a84d5/41df6de9-2f0a-42e1-9ead-82b2987fb220.png" width="60px" alt="Akos Putz" /></a><a href="https://github.com/Xetera"><img src="https://yellow-cdn.veclightyear.com/835a84d5/033574cd-8870-4689-a593-ffc93e791f8e.png" width="60px" alt="" /></a><a href="https://github.com/HoldenLucas"><img src="https://yellow-cdn.veclightyear.com/835a84d5/34d0b30e-84e1-4dba-82ab-ba87b5cc5636.png" width="60px" alt="Holden Lucas" /></a><a href="https://github.com/nartc"><img src="https://yellow-cdn.veclightyear.com/835a84d5/66133b22-aed9-4bef-86a7-06c2df1da277.png" width="60px" alt="Chau Tran" /></a><a href="https://github.com/matejcik"><img src="https://yellow-cdn.veclightyear.com/835a84d5/7c591426-0a53-4496-b884-7a6c25c1ce24.png" width="60px" alt="matejcik" /></a><a href="https://github.com/lucatume"><img src="https://yellow-cdn.veclightyear.com/835a84d5/2fe67184-fd2b-4427-91ce-f71c15f946a5.png" width="60px" alt="theAverageDev (Luca Tumedei)" /></a><a href="https://github.com/IvanZuy"><img src="https://yellow-cdn.veclightyear.com/835a84d5/b1a572b0-34cc-4c9d-9743-25a6264f09c8.png" width="60px" alt="Ivan Zaitsev" /></a><a href="https://github.com/nicholascloud"><img src="https://yellow-cdn.veclightyear.com/835a84d5/b6e36664-7bb4-4554-8f5e-4b4615032f8a.png" width="60px" alt="Nicholas Cloud" /></a><a href="https://github.com/PhotonQuantum"><img src="https://yellow-cdn.veclightyear.com/835a84d5/ebe1eed8-3d3e-4f1d-ab23-a118bd46fd48.png" width="60px" alt="LightQuantum" /></a><a href="https://github.com/GitSquared"><img src="https://yellow-cdn.veclightyear.com/835a84d5/8634314d-095b-474f-b9da-9029e9acc632.png" width="60px" alt="Gabriel Saillard" /></a><a href="https://github.com/ava1ar"><img src="https://yellow-cdn.veclightyear.com/835a84d5/a04b4af1-02fa-47cf-958f-79c1daaf8be1.png" width="60px" alt="Aliaksandr Stelmachonak" /></a><a href="https://github.com/minidfx"><img src="https://yellow-cdn.veclightyear.com/835a84d5/2bec5e42-533e-4725-9cb5-878f3f096ba6.png" width="60px" alt="Burgy Benjamin" /></a><a href="https://github.com/JoeKlemmer"><img src="https://yellow-cdn.veclightyear.com/835a84d5/ab2c446b-4113-44f1-9c24-e3f712a8e88a.png" width="60px" alt="Joe Klemmer" /></a><a href="https://github.com/tobi"><img src="https://yellow-cdn.veclightyear.com/835a84d5/984686f3-6b51-4dfb-b0e4-9625fb53008c.png" width="60px" alt="Tobias Lütke" /></a><a href="https://github.com/benbfortis"><img src="https://yellow-cdn.veclightyear.com/835a84d5/18a748fd-1e57-42fb-a365-60bb501f8974.png" width="60px" alt="Ben Beaumont" /></a><a href="https://github.com/jakewarren"><img src="https://yellow-cdn.veclightyear.com/835a84d5/f00d47ad-24de-4a48-bfbe-6320dca65e44.png" width="60px" alt="" /></a><a href="https://github.com/tgpholly"><img src="https://yellow-cdn.veclightyear.com/835a84d5/3d8161d0-99a7-4d7a-a25d-6c62fb54132a.png" width="60px" alt="Holly" /></a><a href="https://github.com/bitprophet"><img src="https://yellow-cdn.veclightyear.com/835a84d5/63c99294-6b7d-46b2-8dfb-3cff5d6a461d.png" width="60px" alt="Jeff Forcier" /></a><a href="https://github.com/tayleighr"><img src="https://yellow-cdn.veclightyear.com/835a84d5/082f17b3-70b5-4f03-b05a-17e2554cc714.png" width="60px" alt="" /></a><a href="https://github.com/Novakov"><img src="https://yellow-cdn.veclightyear.com/835a84d5/e2e885a2-c1a2-49e4-9150-9946af5df1eb.png" width="60px" alt="Maciej T. Nowak" /></a><a href="https://github.com/farzadmf"><img src="https://yellow-cdn.veclightyear.com/835a84d5/5a5cde75-1d14-4534-be90-2916bfd39b60.png" width="60px" alt="Farzad Majidfayyaz" /></a><a href="https://github.com/nekhaevskiy"><img src="https://yellow-cdn.veclightyear.com/835a84d5/dbfe839e-fd3d-4c38-8983-16b8e5f1256e.png" width="60px" alt="Yury" /></a><a href="https://github.com/reivilibre"><img src="https://yellow-cdn.veclightyear.com/835a84d5/27e9e17d-a516-4524-a881-a14a18b1dcbe.png" width="60px" alt="" /></a><a href="https://github.com/andreaskurth"><img src="https://yellow-cdn.veclightyear.com/835a84d5/8cfd8751-e497-4e77-b2fe-33e5fe81b93c.png" width="60px" alt="Andreas Kurth" /></a><a href="https://github.com/BSteffaniak"><img src="https://yellow-cdn.veclightyear.com/835a84d5/54e776cc-d961-4ddd-93c2-e60c319f99c9.png" width="60px" alt="Braden Steffaniak" /></a><a href="https://github.com/jordan-gillard"><img src="https://yellow-cdn.veclightyear.com/835a84d5/ab3b303a-be2b-486e-9ba0-00561a6a548d.png" width="60px" alt="Jordan Gillard" /></a><a href="https://github.com/smangels"><img src="https://yellow-cdn.veclightyear.com/835a84d5/b90152f9-fb28-4962-b611-3f0787f0e124.png" width="60px" alt="Sebastian" /></a><a href="https://github.com/George-Spanos"><img src="https://yellow-cdn.veclightyear.com/835a84d5/cb906d5e-cc42-4b48-8efd-00a199e76f2c.png" width="60px" alt="George Spanos" /></a><a href="https://github.com/amslezak"><img src="https://yellow-cdn.veclightyear.com/835a84d5/0530c915-7816-4a87-9bfc-19abf10bbaa2.png" width="60px" alt="Andy Slezak" /></a><a href="https://github.com/mkock"><img src="https://yellow-cdn.veclightyear.com/835a84d5/e6a0e2bb-2e02-4d48-9c00-958a619852f7.png" width="60px" alt="Martin Kock" /></a><a href="https://github.com/illarionvk"><img src="https://yellow-cdn.veclightyear.com/835a84d5/802316be-1a47-4eb0-83d5-b70eb3422fcf.png" width="60px" alt="Illarion Koperski" /></a><a href="https://github.com/jessealama"><img src="https://yellow-cdn.veclightyear.com/835a84d5/38346a76-63cc-4f4f-b271-f7d1870a7cc3.png" width="60px" alt="Jesse Alama" /></a><a href="https://github.com/codacy"><img src="https://yellow-cdn.veclightyear.com/835a84d5/18fcb773-f929-4a6e-93cd-f542f4dfae68.png" width="60px" alt="Codacy" /></a><a href="https://github.com/colbr"><img src="https://yellow-cdn.veclightyear.com/835a84d5/9c6fd320-1d4d-40b3-8093-226bdbbd26aa.png" width="60px" alt="Brett" /></a><a href="https://github.com/heijmans"><img src="https://yellow-cdn.veclightyear.com/835a84d5/0eafbd54-5877-431d-9de5-076b258f3df0.png" width="60px" alt="Jan Heijmans" /></a><a href="https://github.com/Vesther"><img src="https://yellow-cdn.veclightyear.com/835a84d5/53c4d539-a0a2-4360-9301-0abdf1435ef6.png" width="60px" alt="Kevin Nowald" /></a><a href="https://github.com/sempruijs"><img src="https://yellow-cdn.veclightyear.com/835a84d5/ec678509-3f50-4b13-9d26-178ee4fcc7e5.png" width="60px" alt="sem pruijs" /></a><a href="https://github.com/omarluq"><img src="https://yellow-cdn.veclightyear.com/835a84d5/a37573af-b4a8-4554-9fe6-13750719a77c.png" width="60px" alt="Omar Luq " /></a><a href="https://github.com/arcanemachine"><img src="https://yellow-cdn.veclightyear.com/835a84d5/f3dac8f5-eebd-495d-b140-34c4878f7dd6.png" width="60px" alt="Nicholas Moen" /></a><a href="https://github.com/ethanjli"><img src="https://yellow-cdn.veclightyear.com/835a84d5/7d1b3f09-4e36-45b1-b19f-dfea8adaa2d1.png" width="60px" alt="Ethan Li" /></a><a href="https://github.com/phubaba"><img src="https://yellow-cdn.veclightyear.com/835a84d5/3e9a84e4-c411-4e11-8b75-551ee7de4521.png" width="60px" alt="" /></a><a href="https://github.com/fomrat"><img src="https://yellow-cdn.veclightyear.com/835a84d5/ee6cab22-7cb4-4154-bc73-9008f462a318.png" width="60px" alt="Brian MacAskill" /></a><a href="https://github.com/canhazcodez"><img src="https://yellow-cdn.veclightyear.com/835a84d5/7f6e0e7d-59c7-4e6b-98f5-66328f93b9dd.png" width="60px" alt="Maxi" /></a><a href="https://github.com/nikbrunner"><img src="https://yellow-cdn.veclightyear.com/835a84d5/31e74d91-a1ad-4a18-b973-1807e2d65ff1.png" width="60px" alt="nbr" /></a><a href="https://github.com/mikybars"><img src="https://yellow-cdn.veclightyear.com/835a84d5/30eec729-1498-40fd-a380-2fc665820e93.png" width="60px" alt="Miguel Ibars" /></a><a href="https://github.com/neunkasulle"><img src="https://yellow-cdn.veclightyear.com/835a84d5/72a3e1e7-16d2-4185-8282-4c62b403ed4d.png" width="60px" alt="Jan Zenkner" /></a><a href="https://github.com/ahkohd"><img src="https://yellow-cdn.veclightyear.com/835a84d5/ec6310d6-c8ad-4d20-9e1b-f07d96458b67.png" width="60px" alt="Victor Aremu" /></a><a href="https://github.com/RVxLab"><img src="https://yellow-cdn.veclightyear.com/835a84d5/1c9490bc-084c-47bd-9dde-1c75a14266c0.png" width="60px" alt="" /></a><a href="https://github.com/igor-ramazanov"><img src="https://yellow-cdn.veclightyear.com/835a84d5/f137d200-5e0d-4fbe-a609-53ec98e0b858.png" width="60px" alt="Igor Ramazanov" /></a><a href="https://github.com/glotchimo"><img src="https://yellow-cdn.veclightyear.com/835a84d5/451b09dd-aecb-4713-a28b-1f8bbfe583ae.png" width="60px" alt="Elliott Maguire" /></a><a href="https://github.com/n8nio"><img src="https://yellow-cdn.veclightyear.com/835a84d5/4722b62a-e70e-4798-ba34-f55d561cbb80.png" width="60px" alt="n8n - 工作流自动化" /></a><a href="https://github.com/joshuadavidthomas"><img src="https://yellow-cdn.veclightyear.com/835a84d5/3fb88728-84c2-44c0-993f-05492ca29654.png" width="60px" alt="Josh Thomas" /></a><a href="https://github.com/josephjacks"><img src="https://yellow-cdn.veclightyear.com/835a84d5/de9c2733-7be3-4b89-a5f5-f0bdd0b50051.png" width="60px" alt="JJ" /></a><a href="https://github.com/FrederickGeek8"><img src="https://yellow-cdn.veclightyear.com/835a84d5/a3b8ee6c-7d7b-4378-94cc-c1aeca24b61d.png" width="60px" alt="Frederick Morlock" /></a><a href="https://github.com/agrippanux"><img src="https://yellow-cdn.veclightyear.com/835a84d5/2f3de2fe-2961-4d6f-b7e6-bacbd2a8df26.png" width="60px" alt="Darren Craine" /></a><a href="https://github.com/ezdac"><img src="https://yellow-cdn.veclightyear.com/835a84d5/f9e45027-e2f3-4205-b2e3-065d94f127e8.png" width="60px" alt="Maximilian Langenfeld" /></a><a href="https://github.com/sarzhann"><img src="https://yellow-cdn.veclightyear.com/835a84d5/05f8c650-16d5-481a-a53c-4227c9a6d8b4.png" width="60px" alt="Nurzhan" /></a><a href="https://github.com/dbuls"><img src="https://yellow-cdn.veclightyear.com/835a84d5/d741a519-67fa-41ca-987a-d7092c1f4ee3.png" width="60px" alt="Davis Buls" /></a><a href="https://github.com/lppassos"><img src="https://yellow-cdn.veclightyear.com/835a84d5/05eb6794-ae6b-4acc-89c3-3ee251667002.png" width="60px" alt="" /></a><a href="https://github.com/chrisolsen"><img src="https://yellow-cdn.veclightyear.com/835a84d5/b1b43a94-edf6-4eeb-9ca8-b638a7a9403b.png" width="60px" alt="Chris Olsen" /></a><a href="https://github.com/neilcode"><img src="https://yellow-cdn.veclightyear.com/835a84d5/37aeb7b8-2c4b-4e4c-8b1b-fa190c7236fc.png" width="60px" alt="Neil Lambert" /></a><a href="https://github.com/dhh"><img src="https://yellow-cdn.veclightyear.com/835a84d5/4a0872d8-689a-4d53-baaf-8bf0db41227e.png" width="60px" alt="David Heinemeier Hansson" /></a><a href="https://github.com/mmv08"><img src="https://yellow-cdn.veclightyear.com/835a84d5/acffc1f4-990f-4a1d-8132-4d2292969c02.png" width="60px" alt="Mikhail" /></a><a href="https://github.com/macmiranda"><img src="https://yellow-cdn.veclightyear.com/835a84d5/e1e53945-996e-469f-bc54-e1047d3eda83.png" width="60px" alt="Marco Aurelio Caldas Miranda" /></a><a href="https://github.com/osarogie"><img src="https://yellow-cdn.veclightyear.com/835a84d5/63cfb9c7-87c7-471f-9e36-7a84ed9f8e48.png" width="60px" alt="Emmanuel Nosakhare" /></a><a href="https://github.com/ethanfischer"><img src="https://yellow-cdn.veclightyear.com/835a84d5/ca68d02d-7a9f-4f0f-9634-1dc122d7bb22.png" width="60px" alt="Ethan Fischer" /></a><a href="https://github.com/poshboytl"><img src="https://yellow-cdn.veclightyear.com/835a84d5/8410a626-22f2-4a0e-8fa5-03c5357434e9.png" width="60px" alt="Terry Tai" /></a><a href="https://github.com/a-jentleman"><img src="https://yellow-cdn.veclightyear.com/835a84d5/9fbac626-7bc8-4990-b0d1-e626312289fa.png" width="60px" alt="" /></a><a href="https://github.com/roesnera"><img src="https://yellow-cdn.veclightyear.com/835a84d5/7ffb861e-993d-493d-8997-320a7055cc16.png" width="60px" alt="Adam Roesner" /></a><a href="https://github.com/herdingdata"><img src="https://yellow-cdn.veclightyear.com/835a84d5/358b5a68-4da3-4477-a2f1-b5d8116cfe0f.png" width="60px" alt="Andy Herd" /></a><a href="https://github.com/wassimk"><img src="https://yellow-cdn.veclightyear.com/835a84d5/7672e4d1-4a91-45dd-90e3-d24562dcd483.png" width="60px" alt="Wassim Metallaoui" /></a><a href="https://github.com/tornikegomareli"><img src="https://yellow-cdn.veclightyear.com/835a84d5/daa464dd-215c-423b-87d0-668469eff135.png" width="60px" alt="Tornike Gomareli" /></a><a href="https://github.com/seven1m"><img src="https://yellow-cdn.veclightyear.com/835a84d5/3cf5cfb8-b115-4741-9d86-7ffc18123723.png" width="60px" alt="Tim Morgan" /></a><a href="https://github.com/sgoridotla1"><img src="https://yellow-cdn.veclightyear.com/835a84d5/748cb9d5-4ebc-4ad2-8f39-5d2d853891b9.png" width="60px" alt="Max Shypulniak" /></a><a href="https://github.com/meshanator"><img src="https://yellow-cdn.veclightyear.com/835a84d5/2c77e462-aefe-44f8-81a0-10110e68e06d.png" width="60px" alt="Meshan Naidoo" /></a><a href="https://github.com/kyu08"><img src="https://yellow-cdn.veclightyear.com/835a84d5/aa171060-ef45-42da-a289-1f4c46bd076b.png" width="60px" alt="kyu08" /></a><a href="https://github.com/piacsek"><img src="https://yellow-cdn.veclightyear.com/835a84d5/351627bd-e86f-48c9-a3f2-0a72ef2de6b5.png" width="60px" alt="Felipe Piacsek" /></a><a href="https://github.com/dimaunx"><img src="https://yellow-cdn.veclightyear.com/835a84d5/7c2d4ef6-faec-4211-9bdb-13b762732173.png" width="60px" alt="dimaunx" /></a><a href="https://github.com/ADIX7"><img src="https://yellow-cdn.veclightyear.com/835a84d5/736af26e-2525-4ddb-978e-c8fba3f8a0a9.png" width="60px" alt="Kovács Ádám" /></a><a href="https://github.com/MatthewYe"><img src="https://yellow-cdn.veclightyear.com/835a84d5/e0f976d4-47b0-4942-8ad4-a3f9a3795809.png" width="60px" alt="叶博" /></a><a href="https://github.com/DusanLesan"><img src="https://yellow-cdn.veclightyear.com/835a84d5/dc5cdc66-61b6-437b-ab55-672c3b980f4c.png" width="60px" alt="Dusan Lesan" /></a><a href="https://github.com/iantanwx"><img src="https://yellow-cdn.veclightyear.com/835a84d5/1f8872a3-8a15-4d2b-bbd9-2e82b9de8c81.png" width="60px" alt="Ian Tan" /></a><a href="https://github.com/maulik13"><img src="https://yellow-cdn.veclightyear.com/835a84d5/e3d77cfb-70e4-4347-b1a4-9a1305f13de3.png" width="60px" alt="Maulik Kataria" /></a><a href="https://github.com/ChanhLy"><img src="https://yellow-cdn.veclightyear.com/835a84d5/f1371707-2230-4086-a55b-629bffdba96b.png" width="60px" alt="ChanhLy" /></a><a href="https://github.com/enzosterro"><img src="https://yellow-cdn.veclightyear.com/835a84d5/6f1fab61-63fc-4f1b-9140-13d05b9bf0a6.png" width="60px" alt="Enzo Sterro" /></a><a href="https://github.com/tfeldmann"><img src="https://yellow-cdn.veclightyear.com/835a84d5/f46effd1-abb6-4cfd-8b71-0db907554e7b.png" width="60px" alt="Thomas Feldmann" /></a><!-- 赞助商 --> </p> ## 电梯演讲

牢骚时间:你以前听说过,git 很强大,但当一切都难以操作时,这种力量有什么用?交互式变基需要你在编辑器中编辑一个该死的 TODO 文件?开玩笑吗?要暂存文件的一部分,你需要使用命令行程序逐步检查每个代码块,如果一个代码块无法进一步拆分但包含你不想暂存的代码,你必须手动编辑一个晦涩难懂的补丁文件?你在逗我吗?有时在切换分支时系统会要求你暂存更改,但切换并取消暂存后才发现根本没有冲突,直接检出分支就可以了?你一定是在开玩笑!

如果你像我一样只是个凡人,厌倦了听说 git 有多强大,而在日常生活中它只是让你痛苦不堪,那么 lazygit 可能适合你。

目录

Lazygit 不是我的全职工作,但它确实是一份相当繁重的兼职工作,所以如果你想支持这个项目,请考虑赞助我

功能

暂存单独的行

在选中的行上按空格键可以暂存它,或者按 v 开始选择一系列行。你也可以按 a 选择当前代码块的全部内容。

暂存行

交互式变基

i 开始交互式变基。然后可以压缩(s)、修复(f)、删除(d)、编辑(e)、向上移动(ctrl+i)或向下移动(ctrl+j)任何待办提交,然后通过按 m 调出变基选项菜单并选择"继续"来完成变基。

你也可以在不显式启动变基的情况下执行这些操作(例如,在提交上按 s 来压缩它)。

这个演示还使用 shift+下箭头选择要移动和修复的一系列提交。

交互式变基

Cherry-pick

在提交上按 shift+c 复制它,然后按 shift+v 粘贴(cherry-pick)它。

cherry-pick

二分查找

在提交视图中按 b 将提交标记为好/坏,以开始 git 二分查找。

二分查找

清空工作树

当你真的想清除运行 git status 时显示的所有内容(是的,包括脏子模块)时,按 shift+d 调出重置选项菜单,然后选择"清空"选项。

清空工作树

修改旧提交

在任何提交上按 shift+a 将使用当前暂存的更改来修改该提交(在后台运行交互式变基)。

修改旧提交

过滤

你可以使用 / 过滤视图。这里我们过滤分支视图,然后按 enter 查看其提交。

过滤

调用自定义命令

Lazygit 有一个非常灵活的自定义命令系统。在这个例子中,定义了一个模拟内置分支检出操作的自定义命令。

自定义命令

工作树

你可以创建工作树,同时处理多个分支,而无需在它们之间切换时进行暂存或创建临时提交。在分支视图中按 w 可以从选定的分支创建工作树并切换到它。

从分支创建工作树

变基魔法(自定义补丁)

你可以从旧提交构建自定义补丁,然后从提交中移除该补丁,拆分出新的提交,将补丁反向应用到索引等。

在这个例子中,我们有一个想要从旧提交中删除的多余注释。我们在提交上按 <enter> 查看其文件,然后在文件上按 <enter> 聚焦补丁,接着按 <space> 将注释行添加到我们的自定义补丁中,最后按 ctrl+p 查看自定义补丁选项;选择从当前提交中移除补丁。

变基魔法 YouTube 教程中了解更多信息。

自定义补丁

从标记的基础提交变基

假设你在一个从 develop 分支分出的特性分支上工作,现在你决定想从 master 分支分出。你需要一种方法只变基你特性分支的提交。在这个演示中,我们先检查 develop 分支上的最后一个提交,然后按 shift+b 将该提交标记为我们的基础提交,接着在 master 分支上按 r 进行变基,只带上特性分支的提交。然后我们用 shift+p 推送更改。

变基到

撤销

你可以按 'z' 撤销最后一个操作,按 ctrl+z 重做。这里我们删除了几个提交,然后撤销了这些操作。 撤销使用引用日志,引用日志是特定于提交和分支的,所以我们无法撤销对工作树或暂存区的更改。

更多信息 撤销

提交图

当在放大的窗口中查看提交图时(使用+_循环切换窗口大小),会显示提交图。颜色对应提交作者,当你在图中导航时,所选提交的父提交会被高亮显示。

提交图

比较两个提交

如果你在一个提交(或分支/引用)上按shift+w,会打开一个菜单,允许你标记该提交,这样你选择的任何其他提交都会与之进行对比。选择第二个提交后,你会在主视图中看到差异,如果按<enter>,你将看到差异的文件。你可以按shift+w再次查看差异菜单,查看诸如反转差异方向或退出差异模式等选项。你也可以按<escape>退出差异模式。

对比提交

教程

<img src="https://i.imgur.com/sVEktDn.png">

安装

打包状态

上述大多数软件包由第三方维护,因此请务必自行验证,并确认维护者是看起来值得信赖的人,他们参加当地体育比赛并通过烧烤筹款等方式回馈社区

二进制发布

对于Windows、Mac OS(10.12+)或Linux,你可以在这里下载二进制发布版。

Homebrew

通常lazygit公式可以在Homebrew核心仓库中找到,但我们建议你使用我们的公式以获得频繁更新的版本。它也适用于Linux。

使用tap:

brew install jesseduffield/lazygit/lazygit

使用核心仓库:

brew install lazygit

MacPorts

从github发布构建的最新版本。 使用tap:

sudo port install lazygit

Void Linux

Void Linux的软件包可在发行版仓库中获得

它们跟随上游最新发布

sudo xbps-install -S lazygit

Scoop (Windows)

你可以使用scoop安装lazygit。它在extras桶中:

# 添加extras桶 scoop bucket add extras # 安装lazygit scoop install lazygit

Arch Linux

Arch Linux的软件包可通过pacman和AUR(Arch用户仓库)获得。

有两个软件包。稳定版基于最新发布构建,git版本基于最近的提交构建。

如何安装AUR内容的说明可以在这里找到: https://wiki.archlinux.org/index.php/Arch_User_Repository

Fedora和RHEL

Fedora/RHEL和CentOS Stream的软件包可通过Copr(Cool Other Package Repo)获得。

sudo dnf copr enable atim/lazygit -y sudo dnf install lazygit

Solus Linux

sudo eopkg install lazygit

Ubuntu

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/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz" tar xf lazygit.tar.gz lazygit sudo install lazygit /usr/local/bin

验证lazygit的正确安装:

lazygit --version

Funtoo Linux

Funtoo Linux在dev-kit中有一个自动生成的lazygit软件包:

sudo emerge dev-vcs/lazygit

Gentoo Linux

Lazygit目前还不在Gentoo主要portage中,但在GURU overlay中有一个ebuild可用

你可以将overlay添加到你的系统并像往常一样安装lazygit:

sudo eselect repository enable guru sudo emaint sync -r guru sudo emerge dev-vcs/lazygit

openSUSE

lazygit软件包目前在devel:languages:go/lazygit中构建。

要在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 lazygit

要在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 lazygit

NixOs

在NixOs上,lazygit通过nix打包并通过nixpkgs分发。 你可以在不安装的情况下尝试lazygit:

nix-shell -p lazygit # 或者启用flakes nix run nixpkgs#lazygit

或者你可以在configuration.nix的environment.systemPackages部分添加lazygit。 更多详情可以在NixOs搜索页面找到。

Flox

Lazygit可以按以下方式安装到Flox环境中。

flox install lazygit

关于Flox的更多详情可以在他们的网站上找到。

FreeBSD

pkg install lazygit

Termux

apt install lazygit

Conda

不同平台的发布版本可在https://anaconda.org/conda-forge/lazygit获得

conda install -c conda-forge lazygit

Go

go install github.com/jesseduffield/lazygit@latest

请注意: 如果你收到声称找不到lazygit或未定义lazygit的错误,你可能需要将~/go/bin添加到你的$PATH(MacOS/Linux),或%HOME%\go\bin(Windows)。不要与C:\Go\bin混淆(后者是Go自己的二进制文件,而不是像lazygit这样的应用程序)。

Chocolatey (Windows)

你可以使用Chocolatey安装lazygit

choco install lazygit

Winget (Windows 10 1709或更高版本)

你可以在Windows终端中使用winget命令安装lazygit,命令如下:

winget install -e --id=JesseDuffield.lazygit

手动安装

你需要安装Go

git clone https://github.com/jesseduffield/lazygit.git
cd lazygit
go install

你也可以使用go run main.go一次性编译和运行(双关语绝对是有意的)

使用

在git仓库内的终端中调用lazygit

$ lazygit

如果你愿意,你也可以通过echo "alias lg='lazygit'" >> ~/.zshrc(或你正在使用的任何rc文件)为此添加一个别名。

键绑定

你可以在这里查看键绑定列表。

退出时更改目录

如果你在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
}

然后执行 source ~/.zshrc,从现在开始,当你调用 lg 并退出时,你将切换到 lazygit 中最后所在的目录。如果要覆盖这个行为,你可以使用 shift+Q 而不是 q 来退出。

撤销/重做

查看文档

配置

查看配置文档

自定义分页器

查看文档

自定义命令

如果 lazygit 缺少某个功能,你很有可能可以通过自定义命令来实现!

查看文档

Git flow 支持

如果你已安装 Gitflow,Lazygit 支持它。要了解 Gitflow 模型的工作原理,请查看 Vincent Driessen 的原始文章。要在 Lazygit 中查看 Gitflow 选项,请在分支视图中按 i

贡献

我们非常欢迎你的贡献!请查看贡献指南。 对于不适合在此仓库讨论的贡献者讨论,请加入 Discord 频道

<a href="https://discord.gg/ehwFt2t4wt"><img src='https://raw.githubusercontent.com/jesseduffield/lazygit/master/.assets/discord.png' width='75'></a>

如果你想了解从哪里开始,可以查看这个视频,它演示了在 lazygit 中创建一个小功能的过程。

本地调试

在一个终端标签页中运行 lazygit --debug,在另一个标签页中运行 lazygit --logs,以并排查看程序及其日志输出。

捐赠

如果你想支持 lazygit 的开发,可以考虑赞助我(GitHub 将在 12 个月内对所有捐款进行一比一匹配)

常见问题

提交颜色代表什么?

  • 绿色:该提交包含在主分支中
  • 黄色:该提交不包含在主分支中
  • 红色:该提交尚未推送到上游分支

自荐

如果你想了解我(Jesse)在开发方面的近况,可以在 Twitter 上关注我或查看我的博客

替代方案

如果你发现 lazygit 不能完全满足你的需求,以下可能是更好的选择:

编辑推荐精选

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

AI办公办公工具AI工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图热门
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

热门AI开发模型训练AI工具讯飞星火大模型智能问答内容创作多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

openai-agents-python

openai-agents-python

OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。

openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。

Hunyuan3D-2

Hunyuan3D-2

高分辨率纹理 3D 资产生成

Hunyuan3D-2 是腾讯开发的用于 3D 资产生成的强大工具,支持从文本描述、单张图片或多视角图片生成 3D 模型,具备快速形状生成能力,可生成带纹理的高质量 3D 模型,适用于多个领域,为 3D 创作提供了高效解决方案。

3FS

3FS

一个具备存储、管理和客户端操作等多种功能的分布式文件系统相关项目。

3FS 是一个功能强大的分布式文件系统项目,涵盖了存储引擎、元数据管理、客户端工具等多个模块。它支持多种文件操作,如创建文件和目录、设置布局等,同时具备高效的事件循环、节点选择和协程池管理等特性。适用于需要大规模数据存储和管理的场景,能够提高系统的性能和可靠性,是分布式存储领域的优质解决方案。

下拉加载更多