8 ms·
Lazygit: Simple terminal UI for Git commands
- EinLama 3y agoI'm using this tool for a couple of months now and I fully enjoy it. I was always the CLI type when it comes to using git. I never liked the ambiguity that regular UI tools introduced. I want to know which git commands are being executed when I click a button or drag and drop a commit. With lazygit, I never missed that feeling of control. All commands are printed and rather complicated rebases become a breeze. Highly appreciate this tool! :)
- vistu 3y agoLooks rather nice when looking at, but I have to say that (for me) the animations in the github page are way to fast to get any feeling of what the tool does.
- fknorangesite 3y agoThis YouTube video is linked from the README: https://www.youtube.com/watch?v=CPLdltN7wgE https://www.youtube.com/watch?v=CPLdltN7wgE
- FrontAid 3y agoI use IntelliJ IDEA and often rely on their own Git functionality. But it cannot stage specific lines, only whole chunks [1]. For that, I've been using lazygit for a couple of months now. I like its simple UI and that it makes staging specific lines very easy and quick. If you like lazygit, you might also be interested in similar Git CLI clients that I collected here [2]. [1] https://youtrack.jetbrains.com/issue/IDEA-186988/Allow-commiting-only-specific-lines https://youtrack.jetbrains.com/issue/IDEA-186988/Allow-commi... [2] https://github.com/frontaid/git-cli-tools#clients https://github.com/frontaid/git-cli-tools#clients
- tomkarho 3y agoIs this something missing specifically from IDEA? In Rider, there are features that allow committing individual lines instead of a whole file. You can select in the commit dialog which lines to include/omit. Also I recommended taking a look at Changelists feature that allows separating certain changes from what would be committed next (I believe it works line by line basis).
- FrontAid 3y agoI don't know Rider, but I assume this is a limitation in all of their IDEs. Yes, you can commit only certain changes within a file. But you can only do that based on whole chunks. For example, if you add two new lines at the end of an existing file, you cannot commit only one line but not the other. The same limitation applies to changelists (at least in IntelliJ IDEA and Webstorm).
- colejohnson66 3y agoDoesn't this come from git itself? If you try `git add -p <file>`, it'll chunk just as "bad".
- nerdponx 3y agoYou can edit the hunk manually. I believe it's also possible to construct a hunk to apply entirely from scratch as long as you get the header right.
- YellowSuB 3y agoYes, git generally stages just hunks with the patch add mechanism, but it is possible to stage single lines, but it is a bit tedious, see: https://kennyballou.com/blog/2015/10/art-manually-edit-hunks/index.html https://kennyballou.com/blog/2015/10/art-manually-edit-hunks...
- tomkarho 3y agoIndeed. That is a limitation with Rider too.
- deleted 3y ago
- sugarpile 3y agoFWIW, the per line staging functionality in GitUp (https://gitup.co/ https://gitup.co/) is quite easy and straightforward. Very lightweight program that you can open via cli (`gitup` when in a git directory)
- hahn-kev 3y agoMacOS only
- CSSer 3y agoWow. VS Code can do that.
- jcurtis 3y agoUnless I'm misunderstanding your comment, this feature is actually included in the latest EAP/beta releases[1]. There is discussion of it at the bottom of the issue you linked. [1] https://blog.jetbrains.com/idea/2023/06/intellij-idea-2023-2-eap-5/#Optiontocommitspecificlinesofcode https://blog.jetbrains.com/idea/2023/06/intellij-idea-2023-2...
- FrontAid 3y agoYes, that's it. Judging from the screencast, I will continue using lazygit for that though. Not a fan of all the clicking. Hopefully there will be a keystroke available for it.
- parentheses 3y agoI found lazygit after building something of my own thay solves some of these problems for me - git-fuzzy [0]. I'd like to share some of my thoughts about the comparison. lazygit is a TUI for git which can behave in a standalone fashion. It's also designed to be quick and easy to use to perform quite advanced actions but ones that a seasoned git user may really want when working with git history. Since I'm already a seasoned git user the main feature I like about lazygit is the ability to surgically work with patches. All that said, a majority of my workflow is tightly bound to git-fuzzy. I use its CLI composability quite heavily in combination with aliases and functions - git-fuzzy excels in this particular way (`git fuzzy log $(git fuzzy branch)` which I invoke using `gl $(gb)` by way of aliases). git-fuzzy is better for working with git-log or git-reflog and interactively searching them. I personally quite like what I made (for myself), though I wish there was a world where I could quickly and easily mash both of these projects together. [0] https://github.com/bigH/git-fuzzy https://github.com/bigH/git-fuzzy
- xuhu 3y agoOf tools that mash interactive GUIs (lazygit) with scriptable shells (git fuzzy), I only know of AutoCAD. Scripts would routinely ask you to interactively select a set of points or an item in a list. Are there other apps that offer scriptable GUIs ?
- shadowfox 3y agoI vaguely remember doing similar things with Matlab, but it has been a while and I don't recollect fully.
- nerdponx 3y ago> Are there other apps that offer scriptable GUIs Isn't this the essence of "plugins" in most GUI apps?
- gpderetta 3y agoEmacs (which, incidentally, uses a lisp for scripting, like autocad).
- 3y ago
- coldblues 3y agoI use this a lot, as well as Magit. Simple terminal commands work fine, but I like selecting what chunks of code I want to commit, and these tools make it especially easy.
- Zambyte 3y agoMy only gripe with Magit (I'm not sure how Lazygit does with this) is how hard it is to search a large commit log. l l will pull up a truncated list of commits that you can search in, but if the commit you want isn't in that list, you have to keep requesting a handful more commits at a time to search in. I find it can be faster to just use git log and search in my pager instead. Otherwise Magit is a fantastic piece of software :D
- Conscat 3y agoWhen you have the magit log transient menu open, press `-n` to disable the limit on the number of commits. You can reconfigure this to be the default if you want, or you could extend the default limit beyond 256.
- level87 3y agoI've been using this a for while now as a replacement for fugitive, since moving from Neovim to Helix. Overall it's great, but I do wish there were some better tutorials for it thou.
- himujjal 3y agoDid you check their Wiki? Have a nice set of gifs
- jesseduffield 3y agoThanks for the feedback, I've been slack on documentation as more features have been added. Do you have a preference for tutorials? e.g. video or text?
- nubinetwork 3y ago[flagged]
- teh_klev 3y agoThis might be helpful when creating lists of things on HN: https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc "Blank lines separate paragraphs."
- wanderingmind 3y agoMaybe some VSCode users can tell me what specific actions Lazygit do that Gitlens (free version), can't do? And gitlens can do a lot (stash handling, commit revert, branch checkout from remote, autofetch, rebase and many more). Or is it just a different workflow that others find easy to use?
- williamdclt 3y agoI use VSCode but not git lens. I don't think it does much that Lens doesn't, it's indeed a different workflow for me: I don't like to use the mouse so the clicky-clicky workflow of Lens doesn't work for me, I'm much faster with lazygit (and I can instantly drop to the `git` CLI if there's something I don't know how to do with lazygit, as I'm already in the terminal). I'm not particularly keen to have my VCS and my code editing in the same software really, although I wouldn't say that it's a superior approach.
- hibbelig 3y agoMy personal take: I like using the keyboard. Lazygit works very smoothly with the keyboard, of course. I tried the git thing that’s part of vscode and it really wants me to click. It is theoretically possible to get by without, but it’s cumbersome.
- wanderingmind 3y agoThanks that makes sense especially for folks that use keyboard and like to do it within CLI.
- williamdclt 3y ago> I'm not particularly keen to have my VCS and my code editing in the same software really, although I wouldn't say that it's a superior approach. Addendum: I'm also not always using VSCode. Sometimes I just use vim if I'm already in my terminal and it's a small edit, at which point I don't want to have to go back to VSCode (potentially having to open the project) just for git
- 3y ago
- p2detar 3y agoHow does this stack up against tig? https://jonas.github.io/tig https://jonas.github.io/tig
- GonGonBungaBoom 3y agoSee https://github.com/Extrawurst/gitui#3--benchmarks-top- https://github.com/Extrawurst/gitui#3--benchmarks-top- for a comparison on indexing the linux kernel
- topher200 3y agotig is great for a read only operations. Looking at the tree, peeking at diffs, finding specific commits. It's quicker to get in and out of. I reach for it instead of `git log`. lazygit makes it super easy to make modifications. Reorder commits, revert specific hunks from commits. I find it easier to use if I need to look at a really big diff. I reach for it instead of `git rebase -i`, and it can do things no native tool can do easily (such as revert or extract specific hunks from commit earlier in the tree. I use both multiple times per day. tig if I just want to look at stuff (fewer keystrokes to look at diffs in the tui!) and lazygit if I want to modify stuff (more powerful!).
- mbirth 3y agoI find marking files, hunks and single lines to commit extremely comfortable in tig. And also reverting is as easy as selecting a file or hunk and pressing Shift+1. But yes, more complex operations are not supported or rather you have to define an external command and thus use an external tool for those.
- toastercat 3y agoI've used this before and it is great. I mainly use Sublime Merge these days, though: https://www.sublimemerge.com/ https://www.sublimemerge.com/
- darkvertex 3y agoIt's nice but I prefer https://github.com/extrawurst/gitui https://github.com/extrawurst/gitui cause it's a little snappier.
- Patrickmi 3y agoOf course it’s written in rust
- gregmfoster 3y agoI'm curious how much people prefer TUIs over editor-plugin-GUIs these days. I'm getting more and more persuaded by the plugin model personally - perhaps partly by how easy it is to discover, install, update, uninstall, etc VSCode plugins
- hahn-kev 3y agoJetbrains has this down so well. I sometimes wish I could open up a light weight version of their IDE just for git management.
- piuantiderp 3y agoEmacs has had this forever...
- WhereIsTheTruth 3y agoThe state of desktop application is pretty alarming, everything is its own web browser.. I'm glad people still build these TUIs, that's exactly what i need, simple interaction with my keyboard, no fuss, no bloat (edit: just checked, the executable is pretty large ~5mb, I wish Go made some effort in that area), a simple executable that can run on my headless server through SSH
- ar_lan 3y agoI prefer it, but I also prefer to stick to the terminal as much as possible. If I were a VSCode user, I might disagree. My main factor is I don't want to have to context switch across applications. I don't feel like I'm doing that if I stay in the terminal. As such, I would imagine if I were a VSCode user, I'd prefer a git plugin there. VCS is very much tied to the code, so I think it makes sense to co-locate.
- heywire 3y agoThe built in support for git in Visual Studio 2022 is pretty good, but I do occasionally find myself reaching for the command line still.
- benrutter 3y agoI don't know if it's a "I want a TUI rather than a plug-in" vibe. For me, it's more of a "it fits my workflow". I use helix as an editor and like to use a range of command line tools and scripts for regular stuff. Lazygit fits right into that and I don't have to leave the terminal. I used vs-code a few years ago and its got plugin was (I assume still is) pretty good, if I used it as my editor then I'd probably use a plug in like you say, but as things are lazygit is both an awesome tool and the path of least resistance.
- tcfunk 3y agoI love this app, use it every day. Very seldom do I need to drop out of it to run a specific command (and even then it’s probably capable of doing it and I’ve just not bothered to figure out how).
- zola_user 3y agoI use lazygit extensively. Have an zsh alias 'lg' for it.
- himujjal 3y agoSo, its not just me!
- qxxx 3y agoI have been using lazygit for years. Love this tool. It is fast, doesn't need much ram, I don't have to leave my terminal (I also use byobu / tmux for tabs). I also use lazydocker from the same developer.
- sigmonsays 3y agowhy not just git cli?
- aequitas 3y agoThere used to be GitX for macOS, which was a very nice, lightweight GUI tool. Sadly it is no longer maintained. There are a few forks though, but they all seem to hang or crash in their own unique way making them unusable for me. Lazygit for me brings over the feature that made GitX the greatest and that was the way it allowed to quickly and easily select a few lines of changes from each file and add them to the index for commit or amend them to a different commit. Lazygit even ramps this up with a lot of nice tooling around interactive rebase (like reordering, editing commits directly, squasing, deleting commits, reword, etc) which makes it a feast instead of a file editing/context juggling chore.
- eviks 3y agoSo how do I discover a command? In a GUI client you'd have a menu, a search through menu, and a command palette with fuzzy search, then also more context-sensitive mouse context menu
- austinjp 3y agoI love lazygit, until I start typing a commit message only to find that I hadn't selected any files, and lazygit has processed each key-press as a command, and my repo is some bizarre state :) But anyway, I typically have it sitting quietly in a terminal pane and just use it for selecting files/hunks/lines for easy commit message editing. It's great for that.
- jesseduffield 3y agoMaintainer here, thanks for the shoutout! A new version just came out today https://github.com/jesseduffield/lazygit/releases/tag/v0.39.1 https://github.com/jesseduffield/lazygit/releases/tag/v0.39.... In the next release we're adding worktree support: if you use worktrees in your daily flow I'd love to know what that flow looks like and what your pain points are so feel free to join the discussion here: https://github.com/jesseduffield/lazygit/discussions/2803 https://github.com/jesseduffield/lazygit/discussions/2803