News for hackers. Stuff that matters.
Re:Lazygit: A simple terminal UI for Git commands by jordanmorgan10 on Tuesday November 30, 2021 @02:27PM (#29396334)
If there is one thing that terrifies me it's using Git, or any source control, from the command line. No matter how long I've been in this industry, I just can't get cozy with doing a lot of heavy lifting in any shell environment. Give me the GUI all day every day.
Re:Lazygit: A simple terminal UI for Git commands by agilob on Tuesday November 30, 2021 @02:41PM (#29396504)
Exactly the opposite for me. I absolutely do not trust GUIs to do the right thing. I don't trust text area to use correct line endings consistently across platforms, I don't trust them to be up to date with new options for `commit` or `checkout`, they never show examples what result will be (--dry-run). None GUI is ever up to date with documentation and contains all functionality which I can autocomplete with [tab][tab] in zsh.

Does any GUI offer `-p` in `git commit` and `git stash`? I literally use it 10s times per day, can't live without it once I started using it.

Re:Lazygit: A simple terminal UI for Git commands by Groxx on Tuesday November 30, 2021 @02:53PM (#29396636)
Literally every git GUI I've used has screwed up a git repository at some point, requiring relatively-advanced CLI use to untangle it. They're wildly untrustworthy IMO. They also almost never perform reasonably on truly large repos, aside from gitk.

Since using a GUI has inevitably required me to learn CLI in depth, and adds the complexity of figuring out what the hell the GUI actually did because of course it doesn't tell you, I'm basically 100% CLI as well.

Re:Lazygit: A simple terminal UI for Git commands by jesseduffield on Tuesday November 30, 2021 @05:53PM (#29398488)
One of the largest pieces of feedback I've had is around displaying the actual git commands that lazygit runs so now there's a new panel that does exactly that, displayed by default. I find that works well for demystifying what's going on and can actually help educate on which commands can satisfy which use cases. It's also kept me accountable in that if I try to satisfy some use case in a sneaky, smart way, it results in a scary looking series of git commands, so I've scaled back some of the 'magical' stuff that was going on for the sake of user confidence.
Re:Lazygit: A simple terminal UI for Git commands by dotancohen on Wednesday December 01, 2021 @03:39AM (#29401958)
I always read these "make git easy" threads and I've also written my own "make git easy" wrapper around git. But this comment is the first that has ever given me confidence in actually trying one (by someone else). Nice job.
Re:Lazygit: A simple terminal UI for Git commands by canadaduane on Tuesday November 30, 2021 @06:27PM (#29398782)
What a great idea! Improved confidence + faster learning in a single feature.
Re:Lazygit: A simple terminal UI for Git commands by agilob on Tuesday November 30, 2021 @03:34PM (#29397119)
>Literally every git GUI I've used has screwed up a git repository at some point,

I got burnt by this with svn... when unfucking things was a lot more complicated and required faster disk and connection.

Re:Lazygit: A simple terminal UI for Git commands by drainyard on Tuesday November 30, 2021 @03:40PM (#29397185)
I found this to be true for a long time, but these days you have something like Fork which is much lore user friendly and FAST! We used to use Sourcetree, which is an abomination in comparison.

I always use(d) the terminal, but Fork is the first time I am considering using a GUI as my main tool.

Granted I haven't had to do anything complicated yet with it, so I don't know if it supports it, but I love it for the basic day-to-day tasks that I do 100's of times a week.

Re:Lazygit: A simple terminal UI for Git commands by dmitriid on Tuesday November 30, 2021 @04:29PM (#29397722)
Also, GitUp (don't know the state of development now, though). Blazingly fast (but not on big repos with years and years of history), almost everything is done via keyboard shortcuts, allows scenarios like "oh, just mov this commit down, this comit up, squash these two, and re-write the commit message" in 5 seconds tops
Re:Lazygit: A simple terminal UI for Git commands by deergomoo on Wednesday December 01, 2021 @04:16AM (#29402123)
Fork is fantastic, plus it’s nice to have a piece of quality software that doesn’t require a subscription. That said, if they released a new major version I would likely pay for it because I’ve been very happy.
Re:Lazygit: A simple terminal UI for Git commands by acherion on Tuesday November 30, 2021 @04:57PM (#29398035)
Fork is amazing, paid user here. We used to be on SourceTree but found out the hard way that it's a massive CPU hog, especially after being open for a long time (at least on Mac OS).
Re:Lazygit: A simple terminal UI for Git commands by Groxx on Tuesday November 30, 2021 @03:42PM (#29397209)
I'll have to give it a try - I'm not opposed to GUIs, I've just had consistently bad experiences :)

And agreed on Sourcetree. It started out promising, but oof. Not any more.

Re:Lazygit: A simple terminal UI for Git commands by reificator on Tuesday November 30, 2021 @02:59PM (#29396727)
I was also in this boat, but vscode has been reliable for me. Maybe I’m not clicking the wrong options, but I used the gut cli exclusively for years so maybe my mental model is in the right place to avoid that.
Re:Lazygit: A simple terminal UI for Git commands by danielvaughn on Tuesday November 30, 2021 @07:30PM (#29399230)
I use Fork for picking apart which lines I want to commit. It's very cumbersome to commit only specific files and lines using the terminal.

I use the terminal for everything else. I would never trust a GUI to do a rebase, not even sure if it's possible with Fork because I've never tried.

Re:Lazygit: A simple terminal UI for Git commands by ggsp on Tuesday November 30, 2021 @10:58PM (#29400501)
It definitely is, and the UX is quite lovely :)
Re:Lazygit: A simple terminal UI for Git commands by stevage on Tuesday November 30, 2021 @04:35PM (#29397796)
I use GitSavvy. It feels the safest to me because I use the same small set of actions frequently. I fuck things up on the command line much more readily and in ways that I find harder to fix.
Re:Lazygit: A simple terminal UI for Git commands by BoorishBears on Tuesday November 30, 2021 @03:08PM (#29396836)
The entire point of a GUI is you get the behavior of -p and --dry-run in a much richer context! I've never seen a GUI that doesn't let you very easily select specific lines for commits and I honestly wouldn't use one that didn't.

I cannot imagine using git and only being able to push entire files...

-

And for the record, I use Sublime Merge and it does a great job mapping to terminal commands.

Hover over any button and you get the exact git command it will run. It doesn't mess with your tree directly, every action maps to a normal human readable git command.

If you want to make a stash with untracked files for example, you just hit the arrow next to "Stash" and get a dropdown with command line args and descriptions for what they do. Sublime Merge will then run it with the exact args you entered, show you the exact CLI command it used, and will show you the exact output.

For me Sublime Merge is strictly better than a terminal. I'm comfortable with terminal commands but it's the terminal with a very nice diff view, clean graphs, easier text editing, etc. I never have any ambiguity about what it's going to do.

Re:Lazygit: A simple terminal UI for Git commands by recursive on Tuesday November 30, 2021 @10:52PM (#29400467)
I cannot imagine using git and having a reason to commit only half a file. I've known it was possible for several years. But never once has it been a solution to any problem I've had. I suppose we both have limited imaginations.
Re:Lazygit: A simple terminal UI for Git commands by yjftsjthsd-h on Wednesday December 01, 2021 @06:19AM (#29402711)
I know this is covering a mistake, but I've occasionally done one thing, then done a separate thing without committing (especially easy to do with things like one-line version bumps or super trivial bug fixes), then used git commit -p to commit+push the first change while still working on the second change locally. Obviously this only comes up because I suck at task management, but it is a real-life time when the feature is helpful.
Re:Lazygit: A simple terminal UI for Git commands by BoorishBears on Wednesday December 01, 2021 @01:20AM (#29401229)
It might be because of the UX around it if you're in the terminal? When it's easy to do you you're more likely to advantage of it.
Re:Lazygit: A simple terminal UI for Git commands by ljm on Tuesday November 30, 2021 @05:09PM (#29398133)
I use magit in emacs and I can create any commit I want by slicing out a bunch of characters in a diff.

The git CLI is workable for a lot of things,but the experience of higlighting an arbitrary block of text and saying "commit THIS" has not been matched in any other git UI. We're not talking about hunks or lines here, but literally committing an abitrary range of characters.

Re:Lazygit: A simple terminal UI for Git commands by caseyohara on Tuesday November 30, 2021 @10:48PM (#29400444)
> committing an abitrary range of characters

Honest question: what is the practical use case for this? I'm a fan of small, atomic commits but I don't recall ever wanting to commit just a range of characters.

Re:Lazygit: A simple terminal UI for Git commands by samus on Tuesday November 30, 2021 @11:08PM (#29400556)
It could be useful for changes in CSV files or text files with table-like formatting where you want to commit the change in just one specific column of a row, but not the other. I could also see it for binary files which aren't structured into lines.
Re:Lazygit: A simple terminal UI for Git commands by ljm on Wednesday December 01, 2021 @11:04AM (#29405145)
I use it quite a lot to stage a subset of a change, and then drop the rest of it. In that sense, it's like an overpowered undo tool that helps me keep a change I want without having to rewrite the whole thing.
Re:Lazygit: A simple terminal UI for Git commands by flohofwoe on Tuesday November 30, 2021 @02:54PM (#29396652)
As far as I have seen (I prefer the cmdline myself) Git UIs usually have all sorts of features to select what changes should go into what commits down to single text lines. IMHO this sort of fine grained 'commit management' would be the only reason to use a git UI over what the command line offers.
Re:Lazygit: A simple terminal UI for Git commands by Groxx on Tuesday November 30, 2021 @02:55PM (#29396663)
`git add -p` does that as well, it's effectively what the GUIs are using. You can also [e]dit each thing and rewrite as desired, though it can be a bit fiddly.

UIs can be nicer though for rewriting / making finer-grained splits than the hunks that -p decides on, definitely agreed there. I have broken out a UI just to simplify staging some gnarly commits. GUIs are also often nicer for understanding and resolving nasty three-way merge conflicts.

Re:Lazygit: A simple terminal UI for Git commands by agateau on Tuesday November 30, 2021 @03:51PM (#29397304)
git gui, which comes with git, is quite efficient to do partial commits. I wrote an article about this a few years ago: https://agateau.com/2016/an-intro-to-git-gui/
Re:Lazygit: A simple terminal UI for Git commands by Groxx on Tuesday November 30, 2021 @04:13PM (#29397531)
I haven't actually tried git-gui, only gitk... I'll have to give it a try, thanks :) A first-party GUI actually gives me some hope for correct behavior. gitk is broadly excellent for example and performs great, though other GUIs do some things more smoothly - exactly what I'd want in a first-party GUI.
Re:Lazygit: A simple terminal UI for Git commands by hoseja on Wednesday December 01, 2021 @02:18AM (#29401515)
>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?!

I repeatedly run into this using the interactive features.

Re:Lazygit: A simple terminal UI for Git commands by Jaxan on Tuesday November 30, 2021 @03:24PM (#29397008)
I very much agree to this. I almost always use “git add -p”.
Re:Lazygit: A simple terminal UI for Git commands by Groxx on Tuesday November 30, 2021 @03:40PM (#29397190)
tbh I think the staging area (and popularizing local branches) may be git's greatest contribution. being able to selectively build a commit is a game-changer for creating understandable histories, and stopping local-tweak "leakage".

distributed VCS is neat and all, but the vast, vast majority of cases have a canonical source-of-truth repo somewhere, and the rest are effectively just private mirrors. for those cases, distributed is mostly a significant source of complexity rather than capability. though it is significant to have an "escape hatch" when you need it.

Re:Lazygit: A simple terminal UI for Git commands by ossopite on Tuesday November 30, 2021 @02:57PM (#29396706)
yes, and in my experience UIs make this much easier than -p

but for me a bigger reason to prefer a git UI is that I can actually see the graph. I can do things like drag branches between commit nodes. I find this so much easier and safer than the cli

Re:Lazygit: A simple terminal UI for Git commands by u801e on Tuesday November 30, 2021 @06:23PM (#29398730)
I may be in between the GUI and CLI camps. I actually use git via a TUI (text user interface) by using vim to either read from or write to git commands.

I can stage hunks by yanking the diff header (excluding the line that starts with @@) and pasting it above the hunk I want to stage and then filtering the hunk through:

    :'<,'> !git apply --cached -
If I want to unstage it, I can press u to restore the hunk I just filtered and then run

    :'<,'> !git apply -R --cached -
I can commit from within vim by reading the verbose status output by running:

    :r !git status -v
typing my commit message at the top and filtering it through

    :'<,'> !git commit -F -
> Does any GUI offer `-p` in `git commit` and `git stash`? I literally use it 10s times per day, can't live without it once I started using it.

In addition to what I wrote above using git apply --cached, I can actually edit hunks from within vim and then filter the hunk (with the diff header) through the recountdiff utility that comes with patchutils. That basically updates the numbers in the line that starts with @@ to account for the changes in the number of added and removed lines introduced by the edit. This way, I can stage my changes and still exclude extraneous changes or debug statements I've added to the code.

I've actually found this to be a better experience compared to using the -p option.

Re:Lazygit: A simple terminal UI for Git commands by reificator on Tuesday November 30, 2021 @02:57PM (#29396695)
> Does any GUI offer `-p` in `git commit` and `git stash`? I literally use it 10s times per day, can't live without it once I started using it.

VSCode’s GUI handles most of what I use -p for, though if I need to use `s` inside -p I drop to the integrated terminal. Not sure if the gui has an equivalent but I haven’t noticed it.

Stash on the other hand isn’t missing anything I care about: the gui lets you name stashes if you want, apply latest, etc…

Re:Lazygit: A simple terminal UI for Git commands by dceddia on Tuesday November 30, 2021 @04:16PM (#29397563)
In regards to `-p` -- Lazygit does this. You can press Spacebar to stage individual lines and then partially commit or stash the staged stuff.

I like it better than git's built-in `-p` because you don't have to rely on git chunking things up the way you hoped, or spend time splitting git's chunks (hunks?) to get the specific line you wanted to stage.

Re:Lazygit: A simple terminal UI for Git commands by sharperguy on Wednesday December 01, 2021 @05:47AM (#29402551)
I agree with you, but it does feel strange whenever I do dip into IDEs which have thousands of features built-in to keep you inside the IDE but to then revert back to the command-line to do git stuff. I can imagine for someone who typically uses an IDE, especially if they work on Windows or OSX it would be even weirder.
Re:Lazygit: A simple terminal UI for Git commands by smusamashah on Tuesday November 30, 2021 @08:46PM (#29399713)
IntelliJ allows partial commits really well. Use it all the time. SmartGit also does the same. One problem with intellij UI is that it doesn't let you 'uncheck' line ending change from being staged like it does for individual changes in a file.
Re:Lazygit: A simple terminal UI for Git commands by eschneider on Tuesday November 30, 2021 @04:57PM (#29398028)
I'm definitely team command-line for git, but I've been happily using lazygit to quickly review repo changes before committing and it's been pretty good for that.
Re:Lazygit: A simple terminal UI for Git commands by bradwood on Tuesday November 30, 2021 @04:51PM (#29397960)
not quite a "GUI", but lets not forget about vim-fugitive which does all this and a lot more besides.
Re:Lazygit: A simple terminal UI for Git commands by gefhfff on Tuesday November 30, 2021 @07:51PM (#29399366)
Gitkraken has an undo button :)
Re:Lazygit: A simple terminal UI for Git commands by bogwog on Tuesday November 30, 2021 @08:31PM (#29399625)
I know this is going to sound elitist, but it always bothers me to see comments like this that make it seem like it's okay to not learn how computers work even though you're a software developer (which I'm assuming you are).

The command line isn't some mystical scary thing, it's a extremely effective method of controlling a computer. It's survived this long for a reason, and it's not going to go anywhere. It's powerful, and extremely simple. Children learn how to use it every day (nerdy children, but still).

Try spending a few hours over the weekend actually trying to learn it. If you do, you'll see how it's a lot easier than you thought, and saying that you're "terrified" of it is silly.

Re:Lazygit: A simple terminal UI for Git commands by dartharva on Wednesday December 01, 2021 @08:01AM (#29403250)
I think most of the aversion towards the terminal comes from how easy it is to screw up things with it as well. There are hundreds of horror stories where one missing "-" or some other character ended up nuking people's entire works and databases worth many hours. Having a GUI gives a buffer and dramatically lowers the chances of doing things that you didn't intend to do.
Re:Lazygit: A simple terminal UI for Git commands by wyclif on Wednesday December 01, 2021 @08:17AM (#29403359)
Another aspect of this is that people will never really learn Git with a GUI and all these aliased commands. I'm not against aliases and I use them, but only on software that I'm very familiar with. Developers who are afraid of Git need to sit down and read Pro Git and learn the most commonly used commands, and use a quality reference for the more obscure ones.
Re:Lazygit: A simple terminal UI for Git commands by PetahNZ on Tuesday November 30, 2021 @11:46PM (#29400767)
> extremely simple

For some things, definitely not for doing a 3 way merge.

Re:Lazygit: A simple terminal UI for Git commands by weaksauce on Tuesday November 30, 2021 @03:55PM (#29397348)
i can firmly say that installing emacs and doom emacs is well worth it solely for the magit interface. simply phenomonal.

if you know the bare basics of emacs(like a few file commands and how to exit), magit and vim that is a huge productivity win. magit is simply the finest complete git gui that does most things seamlessly.

simple workflow

in the project dir

$ emacs

spc-g-g to enter magit

? shows help(and every command pops up a menu with options)

j/k to navigate lines up and down

s and u to stage and unstage chunks of text/files/lines

x to delete something

cc to initiate a commit

edit the commit message

ctrl-c ctrl-c commit.

ctrl-c ctrl-c abort commit

q or escape goes back a "page" like from viewing the log to go back to the staging area

the trick is everything follows that basic form where [a-zA-Z] starts a command, pops up a menu and shows the next options but the general trend is that it usually is the same two letters. bb is checkout a branch and it usually pre-populates the thing you are on if that is applicable. ll is log this branch. la is log all branches and everything in the log is interactive.

it's pretty magical.

Re:Lazygit: A simple terminal UI for Git commands by stevage on Tuesday November 30, 2021 @04:36PM (#29397810)
I haven't used that one, but the experience you describe is similar to GitSavvy in Sublime. Which is the only reason I install sublime these days.
Re:Lazygit: A simple terminal UI for Git commands by weaksauce on Tuesday November 30, 2021 @05:32PM (#29398319)
So I just tried it out and it's noticeably more irritating than magit on first brush:

doesn't work well with vim plugins... need to go to insert mode to actually interact with it (might be configurable and fixable)

stuff that takes one keystroke on magit is clunkier in gitsavvy. tab in magit expands short diffs from the main status page where you can stage or unstage selections or get an overview of the changes. l to "inline diff" opens a diff in a new file whereas tab just opens and closes sections on the main dashboard. ctrl-jk move from chunk to chunk. enter opens the file to edit or more generally does an action like view the commit under the cursor if you are in a the log graph and q will "quit" out and pop the interaction back to the log graph.

it's hard to overstate just how well everything flows in magit and i've never heard anyone say anything bad about it other than something like I wish it wasn't tied to emacs. simply the best and most well thought out piece of software i've used.

edit: i'm just scratching the surface on what magit can do... literally everything is possible through the interface even one off git commands but almost everything is very easy and interactive from any point in the interface

Re:Lazygit: A simple terminal UI for Git commands by w0m on Tuesday November 30, 2021 @03:07PM (#29396827)
Honestly... I'm the exact opposite. It's impossible to craft a complex GUI intuitively I think.
Re:Lazygit: A simple terminal UI for Git commands by recursive on Tuesday November 30, 2021 @10:53PM (#29400475)
Apparently it was also impossible to craft a complex CLI intuitively.
Re:Lazygit: A simple terminal UI for Git commands by w0m on Tuesday December 07, 2021 @11:54AM (#29474929)
agreed. verbose `-h` with examples being The Dream:)
Re:Lazygit: A simple terminal UI for Git commands by nnanda on Tuesday November 30, 2021 @04:04PM (#29397428)
It's totally opposite for me. I can't understand the UI apps for GIT. Right now I am using IntelliJ Idea and it has an excellent GUI for GIT; however, for all my GIT work, I still go to terminal app. :)
Re:Lazygit: A simple terminal UI for Git commands by mukesh610 on Tuesday November 30, 2021 @09:00PM (#29399804)
Usually, I feel like git is more than enough. But when I have my push rejected because I failed to fetch first, it's just a single click in IntelliJ to fetch, rebase my work on that and push it again.

There's also hub, from GitHub. I find myself using "hub sync" to update all my local branches at once.

Re:Lazygit: A simple terminal UI for Git commands by 908B64B197 on Tuesday November 30, 2021 @05:47PM (#29398434)
The command-line is the gateway to scriptability.

> I just can't get cozy with doing a lot of heavy lifting in any shell environment

I've argued that undergrads should spend their first year (or first semester) almost exclusively on the terminal/in the shell. Sure it makes some operations cumbersome but after you get over the learning curve the returns are spectacular.

Re:Lazygit: A simple terminal UI for Git commands by teawrecks on Tuesday November 30, 2021 @04:55PM (#29398011)
I think it's possible to create a git GUI that is superior to the cmdline, but I've never seen it. SublimeMerge usually works fine, very useful for staging hunks. I still do interactive rebase on the cmdline tho.
Re:Lazygit: A simple terminal UI for Git commands by rackjack on Tuesday November 30, 2021 @04:12PM (#29397522)
This has the same vibe as cooking a piece of beef until it's shoe leather
Re:Lazygit: A simple terminal UI for Git commands by GhettoComputers on Tuesday November 30, 2021 @04:18PM (#29397587)
It’s more like using hamburger helper instead of a spice rack, a GUI can be excellent and better than CLI, beef isn’t always better when it’s overcooked.
Re:Lazygit: A simple terminal UI for Git commands by bogwog on Tuesday November 30, 2021 @08:33PM (#29399641)
> a GUI can be excellent and better than CLI

A unicycle can also be better than a car. Doesn't mean anyone should ever choose a unicycle over a car (unless you're a clown I guess)

Re:Lazygit: A simple terminal UI for Git commands by GhettoComputers on Wednesday December 01, 2021 @11:07AM (#29405177)
If you prefer imagemagick to photoshop.
Re:Lazygit: A simple terminal UI for Git commands by chana_masala on Tuesday November 30, 2021 @02:43PM (#29396520)
That's funny, I'm the exact opposite. An old gray beard pair programmed with me at my first development job. He taught me Vim and Git CLI. I've never been able to get used to any UI over Git. I am way faster and more proficient with the CLI.