Live data from Hacker News

Magit, the magical Git interface (2017)

emacsair.me

301–310 of 357 posts

Re: Magit, the magical Git interface (2017)

#301

Earlier quoted context omitted.

> stash some of my changes, switch branch, cherry pick a commit, switch branch, do an interactive rebase reordering commits and dropping one, pop one of my stashes > working with code becomes a fluent experience, rather than fighting with your tools I also do this regularly, but on my terminal. I don't feel like I'm fighting the git tools. Is this a common experience? I enjoy using git GUIs as well, especially for vi…

> I don't feel like I'm fighting the git tools. Is this a common experience? Yes. Today I spent way too much time explaining to a coworker that what he was complaining “should be easy to do but seems impossible” was actually quite simple, only to spend ages explaining how git works, why he wasn’t understanding the paradigm. And after all that help what he needed to do was simply to “git checkout feature-A && git merg…

“minimal viable knowledge" describes my git knowledge. I simple don't have time to become a git expert. After all git is only a source control tool, there are way more important things to deal with that impact our customers.

Re: Magit, the magical Git interface (2017)

#302
post #9

Magit is an exceptionally well made interface to Git. Yes, it’s built on top of Emacs, and that might stop many from even looking into it. - I am glad I made a deep dive into Emacs last year, and although I stopped using it as an IDE (VS Code is just too good), I still come back to it because of Magit (and macros, general text editing and org-mode). Yes, I have an interface for Git in VS Code as well, but it‘s very r…

> I still haven‘t found out how to select several disconnected lines for staging in VS Code. In the Source Control window, select your file then in the right panel: - Select the first range of lines - Alt + select the second range of lines - Cmd + Shift + P > "Git: Stage Selected Ranges" or in multiple steps (I usually do it like that): - Select the first range of lines - Cmd + Shift + P > "Git: Stage Selected Ranges…

Or just right click on the selected lines and Stage Selected Range

Re: Magit, the magical Git interface (2017)

#303
post #37
post #36

Earlier quoted context omitted.

Open the diff, select the lines, right click, "stage selected lines".

But how do you select lines / changes spread all over the file? Doesn‘t work via Shift or Command click.

You can either do it multiple times (my preference), or you can use Alt for multiple selections.

Re: Magit, the magical Git interface (2017)

#304
post #233
post #203

Earlier quoted context omitted.

> Magit has great support for staging parts of lines This is news to me. > select the section you want to stage and press 's'. It stages line-wise for me. How do I get it to stage less than an entire line?

When your press 's', you should have a region selected, in order to stage that region - if your cursor is just sitting on a line without selecting part of it, you'll (probably) just get the whole line staged.

When I press s, the entire line is staged even if my region is a subset of that line.

Re: Magit, the magical Git interface (2017)

#305
post #144
post #135

Earlier quoted context omitted.

I am the same. After the pandemic started and I had to witness over screen share how colleagues "use" (fight) git with all sorts of GUI tools, I had to realize that no GUI can be good enough while one doesn't understand git, or, even worse, it can be contraproductive, because people using these GUIs _think_ they understand, but they don't. I even ended up creating a (tailored) 2x90min git course... All that said, I h…

Why would I use magit over the git CLI? 1. Discoverability. It'll display the contextually relevant options and commands at most points. By using magit, you're learning the git CLI commands at the same time, including commands that you'd normally never come across without a comprehensive read of the manual or release notes. 2. Fewer keypresses. Also, extra shortcuts for some common operations. 3. The bits that CLIs a…

I'm usually a pro-GUI person but I've always found git GUIs to be confusing/trying to paper over the model in a way that made me not like them. Though I don't mind what IntelliJ has. Maybe I need to give this magit tool a try as well.

Re: Magit, the magical Git interface (2017)

#306
post #203

Earlier quoted context omitted.

> Magit has great support for staging parts of lines This is news to me. > select the section you want to stage and press 's'. It stages line-wise for me. How do I get it to stage less than an entire line?

The second line you quoted tells you how.

It does not. As I said, pressing s does not stage less than a line for me, even if my region is a subset of the line.

Re: Magit, the magical Git interface (2017)

#307
post #43

Magit is such an unbelievably good piece of software. If you haven't used it, please at least take a look. It seems like "just a GUI for git", but that's missing the point — many operations suddenly become frictionless, so your entire workflow changes. I regularly do things like "stash some of my changes, switch branch, cherry pick a commit, switch branch, do an interactive rebase reordering commits and dropping one,…

> stash some of my changes, switch branch, cherry pick a commit, switch branch, do an interactive rebase reordering commits and dropping one, pop one of my stashes > working with code becomes a fluent experience, rather than fighting with your tools I also do this regularly, but on my terminal. I don't feel like I'm fighting the git tools. Is this a common experience? I enjoy using git GUIs as well, especially for vi…

> I don't feel like I'm fighting the git tools

I don't feel like I am either - I think some people are not fans of CLI. Full disclosure: I also don't "get it" when people say they can't use tar without looking up the help/man pages.

I get by with less than 10 git commands - in rough order of decreasing frequency: pull, commit, add/rm, push, stash, checkout, merge, and more rarely bisect, revert and reset.

Re: Magit, the magical Git interface (2017)

#308
post #234

Earlier quoted context omitted.

What I dislike with git terminal UI is that commands reflect the innards of git, not what the user wants to do. It also forces a deeper understanding of the innards for basic commands than ought to be necessary. Examples where undoing an operation looks totally different to doing it: - To stage a change you `add` it, to unstage you `reset HEAD` - To commit you `commit`, to undo a commit you `reset --hard HEAD^` The l…

> If you mistype it and nuke more than the last commit, that's also a bit bad - and fairly easily done. If you ever run into this, you can use `git reflog` to see the history of your local actions. It's possible to revert almost any action with it. Reset a few commits that you've never pushed to remote? No worries! Just go to `git reflog`, find a point before it happened, and `git reset` to it. $ git reset --hard HEA…

> It's really hard to lose changes once they've been committed.

I've still managed to do it (or maybe I used git rm to delete some files that weren't committed?) so let me give one more shout out to 'git fsck' which saved me here.

Re: Magit, the magical Git interface (2017)

#309
I mention this every time this comes up. But I absolutely hated magit. It's the worst kind of "nannyware knows best" integration, and it doesn't belong anywhere near an editor. It's a fine front end to git, I'm sure, if you're actually willing to stop and re-learn how to use git.

In my particular case, it was cute for a while until I did my first "git rebase -i" to reorder some patches or whatever and found myself in some kind of magical editor mode where nothing worked the way I knew. I literally couldn't figure it out from what was on the screen. Totally greek. Utterly useless without further learning.

Did I stop and read the docs to figure out how it wanted me to rebase in this brave new world? Hell no. I restarted emacs, disabled it, and never looked back. Right into the garbage it went.

Do. Not. Break. Workflows. Software that doesn't understand this principle is something I don't trust not to break itself when its developers decide to get cute. Stay away.

(Does seem pretty though)

Re: Magit, the magical Git interface (2017)

#310
post #309

I mention this every time this comes up. But I absolutely hated magit. It's the worst kind of "nannyware knows best" integration, and it doesn't belong anywhere near an editor. It's a fine front end to git, I'm sure, if you're actually willing to stop and re-learn how to use git. In my particular case, it was cute for a while until I did my first "git rebase -i" to reorder some patches or whatever and found myself in…

Your past tense usage of the word 'hate' made me think your story was going in a very different direction.
Post reply on HN