Live data from Hacker News

Lazygit: Simple terminal UI for Git commands

github.com

61–70 of 82 posts

Re: Lazygit: Simple terminal UI for Git commands

#61
post #29

I 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.

My 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 o…

When 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.

Re: Lazygit: Simple terminal UI for Git commands

#62
post #44

I 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 s…

Interesting project... in the hopes of maybe nerd-sniping you (or having someone tell me where it already exists), I'll tell you the story I'd really like a solution to but can never seem to find time to build: I have 5 un-pushed commits. I missed a 1-line change to that first one. I add that one line change to staging (gitui/lazygit/whatever), then I want to `git commit --fixup=COMMIT`. Finding that COMMIT is always…

Lazygit allows you to easily « add » your stated changes to any commit (doing a rebase under the hood). Stage stuff, find the commit (the UI helps to quickly find the right commit) and press « a » for amend.

It’s not quite as automatic as you describe, but it’s super quick if you vaguely know what commit you want to amend and there’s no magic happening: just a good ui

Re: Lazygit: Simple terminal UI for Git commands

#63
post #3

Looks 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.

This YouTube video is linked from the README: https://www.youtube.com/watch?v=CPLdltN7wgE

Re: Lazygit: Simple terminal UI for Git commands

#64
post #49
post #47

Earlier quoted context omitted.

I usually solve this by commiting my fixup in a dummy commit, then do a rebase -i HEAD~n where n is the number of commits I want to look back at. Then during the rebase I just move my commit below the one that seem the most appropriate and mark it for squash. Execute the rebase. Done

Wow, I never realized that changing the order of commits in an interactive rebase was a legit operation. Thanks for the tip!

Another way to handle this if you haven't made the change yet is to do a `git rebase -i head~4` (or however far back) and mark the place where the change needs to happen as "edit". Make your change, add the file, then `git rebase --continue`.

If you've already made the change but haven't committed it, you can stash it before doing the rebase, then pop the stash while editing that commit.

Re: Lazygit: Simple terminal UI for Git commands

#66
post #44

I 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 s…

Interesting project... in the hopes of maybe nerd-sniping you (or having someone tell me where it already exists), I'll tell you the story I'd really like a solution to but can never seem to find time to build: I have 5 un-pushed commits. I missed a 1-line change to that first one. I add that one line change to staging (gitui/lazygit/whatever), then I want to `git commit --fixup=COMMIT`. Finding that COMMIT is always…

This was my bugbear for a long time too, and then I found fzf-git.sh (actually its PowerShell equivalent, PSFzf).

fzf (absolutely incredible tool with many uses) gives you fuzzy searching of anything you care to name, and fzf-git combines this with shell key bindings to let you pop up a fuzzy-searchable list of branches/commits/tags/whatever while typing your fixup command, then paste the object you select into your in-progress command line.

No more counting commits in log output to know how many ^ to put after HEAD, or copying out segments of commit SHAs!

Re: Lazygit: Simple terminal UI for Git commands

#67
post #47
post #44

Earlier quoted context omitted.

Interesting project... in the hopes of maybe nerd-sniping you (or having someone tell me where it already exists), I'll tell you the story I'd really like a solution to but can never seem to find time to build: I have 5 un-pushed commits. I missed a 1-line change to that first one. I add that one line change to staging (gitui/lazygit/whatever), then I want to `git commit --fixup=COMMIT`. Finding that COMMIT is always…

I usually solve this by commiting my fixup in a dummy commit, then do a rebase -i HEAD~n where n is the number of commits I want to look back at. Then during the rebase I just move my commit below the one that seem the most appropriate and mark it for squash. Execute the rebase. Done

If you have `fzf` installed you might try this alias.

    frbi = "!f() { git rebase -i $(git log --pretty=oneline --color=always | fzf --ansi | cut -d ' ' -f1)^ ; }; f"
I do: `git frbi` (which in my mind means Fzf ReBase Interactive)

Then I can easily scroll up to the commit I want to start the rebase on.

Re: Lazygit: Simple terminal UI for Git commands

#68
There 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.

Re: Lazygit: Simple terminal UI for Git commands

#69
post #44

Earlier quoted context omitted.

Interesting project... in the hopes of maybe nerd-sniping you (or having someone tell me where it already exists), I'll tell you the story I'd really like a solution to but can never seem to find time to build: I have 5 un-pushed commits. I missed a 1-line change to that first one. I add that one line change to staging (gitui/lazygit/whatever), then I want to `git commit --fixup=COMMIT`. Finding that COMMIT is always…

Lazygit allows you to easily « add » your stated changes to any commit (doing a rebase under the hood). Stage stuff, find the commit (the UI helps to quickly find the right commit) and press « a » for amend. It’s not quite as automatic as you describe, but it’s super quick if you vaguely know what commit you want to amend and there’s no magic happening: just a good ui

Ty. I've seen similar in other tools, and I agree that it's super quick... unless you sign your commits with a key that requires a physical touch of a yubikey. Then it's for every commit that comes after the one you just modified.

Re: Lazygit: Simple terminal UI for Git commands

#70
post #54
post #44

Earlier quoted context omitted.

Interesting project... in the hopes of maybe nerd-sniping you (or having someone tell me where it already exists), I'll tell you the story I'd really like a solution to but can never seem to find time to build: I have 5 un-pushed commits. I missed a 1-line change to that first one. I add that one line change to staging (gitui/lazygit/whatever), then I want to `git commit --fixup=COMMIT`. Finding that COMMIT is always…

https://github.com/tummychow/git-absorb Does a very nice job of this for me.

>> git absorb will automatically identify which commits are safe to modify, and which staged changes belong to each of those commits. It will then write fixup! commits for each of those changes.

This looks like exactly what I wanted. Thank you!

Post reply on HN