Hacker News new | ask | show | jobs
by aidenn0 1853 days ago
I haven't tried very hard yet, but magic has been fairly unintuitive for me. Perhaps it's just that I've been using git for so long.

There have been several times that I tried something with magit, and messed things up enough that I just dropped into a shell and did everything with the git command line

5 comments

Magit is not terribly intuitive.

It looks a bit like a menu-based GUI, so you'd expect to navigate around and use a standard set of keys, but most of it is actually powered by special key combinations.

Now, in some circumstances, that works fine, but honestly the interface could be simplified a bit and probably made faster to use. And less prone to the "oh shit, I thought I was typing something but now I actually hit 3 different Magit key combinations and have no clue what just happened".

Personally, I'm hoping someone takes the standard VC thing in Emacs and adds some of the Magit features to that. But meanwhile, I'm using Magit. :)

There's definitely some aspects of it which I struggle with. Like cherry picking a commit always feels somewhat painful, and I can never remember offhand the exact menus and keys to press to do it. But for day to day development, it's fast and great. I love having the separation between the push branch and merge branches for example, which feels very natural in a PR workflow. And the forge integration is brilliant.
Cherry-picking is amazing with magit. I use spacemacs so my magit has evil style keybindings.

I just open up a log view to the branch i'm cherry-picking from, move the cursor to the commit I want to pick, then if I don't remember what the key is I just press ? and it shows me all the commands, then I press A for cherry-picking, and it immediately populates it with the commit that my cursor is on in the log view. Easy-peasy.

I think it's having to go into a log view that bugs me. I just want to press one button for cherry pick, point it to a ref and be done. It might be possible but I haven't figured out how yet.
Do you remember what you tried?

Yours has been literally the first negative comment out of hundreds of comments I've read about magit. It'd be interesting to learn what didn't work for you and why.

I didn't like it, I have several friends who tried it and didn't like it. The main problem (for us) was that people said "Hey, this is so great you should use it even if you don't use emacs".

This is (in my opinion) terrible advice, as you need to be a fairly competent emacs users to use magit, else you will keep hitting weird situations you can unable to escape (as you don't know the emacs thing to do).

I use emacs and still struggled with it. The interface is not particularly emacsy.
Cherry pick is faster and easier for me in the CLI. I’ve read Magit’s documentation on Cherry pick dozens of times and I still have no idea what it’s doing. I think I have successfully done it in magit once, but now I don’t bother and just do it on the command line.

For everything else I absolutely love magit. The ability to stage and commit chunks in a visual fashion is an unbeatable killer feature!

I do cherry picks in magit by:

1. Check out target branch

2. l o (log other) source branch

3. Highlight commits from list you want to cherry pick.

4. A A to apply the pick (I typically throw a -x flag into there too)

Thank you! That workflow makes sense. We’ll see if I remember that next time I Cherry-pick.
The first odd thing is that magit runs in emacs' working directory, rather than the directory of the buffer you launch it in (my experience with most emacs commands is that they will take the cwd from the buffer). I'm going to have multiple git repos, and I usually only start emacs once, so this gets me almost every single time.

The submenus are also a bit overwhelming. I just wanted to stash my working tree, not be given dozens of options for how to stash! Emacs already has a way to signal that you want to give an option to a command, so this interface feels very un-emacsy. "M-x magit-stash" should just do the common thing imo. C-u M-- prefix if I want something fancy.

Another time, I fat-fingered a branching operation, and I spent a good five minutes trying to figure out how to fix it within magit, and then gave up and solved it in 30s from the cli

Magit always opens to the buffer's repo IME. I use dozens of repos simultaneously so I experience it daily.

EDIT: okay dozens overall, < dozen simultaneous

My experience is the same. Probably because I'm so used to git on the command-line already magit doesn't seem much benefit.

I just gave it a try:

magit-blame seems hard to read, I guess it's a limitation of emacs, or can it be configured to show the author name on the left of the line like CLI git blame?

I tried to find the equivalent of "git add --patch", but did not find it in the info manual.

> magit-blame seems hard to read, I guess it's a limitation of emacs, or can it be configured to show the author name on the left of the line like CLI git blame?

There are different styles available. While blaming a file, press B to open the popup, then c to cycle through them.

> I tried to find the equivalent of "git add --patch", but did not find it in the info manual.

That's just the entire staging workflow. You see a list of changed files, which you can stage per file. Or you can expand a file to its changed chunks using TAB, then stage chunk by chunk. Or you can select some lines in the chunk and stage only those.

I've had the same experience. I've been using org-mode as my primary note-taking tool for several months now and am getting more comfortable with emacs as a result, but while I can see the appeal of magit, the "spend time learning how emacs git" vs "use the CLI to do what I want in 3 s" hasn't balanced out yet in magit's favor. At some point I'll probably sit down and take like a half day or so to actually learn magit, but git CLI isn't really broken for me so the drive to learn an alternative git tool hasn't been all that strong. Still, magit seems nice, so one of these days I'll probably make the effort.
How often do you guys do really crazy stuff with git? I do some rebasing (interactively and not) and some cherry picking, very rarely do I touch reflog (in which case I do use the CLI).

What kind of race car stuff does git CLI offer that makes you have to go through weird contortions in magit :)?

Well to use magit, first it's "ah, how do I open magit again?" Then it's "crap, now my org-mode buffer has been replaced by magit when I really wanted it in a separate tab but forgot to do the right key combo for that", then 5 minutes of googling "how to go back to previous screen in emacs doom", then remembering it's called a "buffer" That kind of stuff. I still get thrown off a surprising number of time by fat-fingering something and my emacs doing something surprising that I don't understand and am not sure what keys I touched to make it do that, and being unable to go back easily.

So it's really 100% on me for not being an emacs native rather than any shortcoming of magit per se, and as I said at some point I'll probably invest the time, but I _already_ have muscle memory for working in my terminal.

Hang in there. I was a beginner at magit (and emacs, to boot) and had to keep at it for a few weeks before it became intuitive for me. I also had to google how to push and fetch and revert every time, because I would keep forgetting it. And emacs keybindings was weird to me at the time, since I was used to vim keybindings.

Just practice, practice, practice. I can attest that the benefits are worth your while (if you use git daily, at least).

> I just dropped into a shell and did everything with the git command line

Note that you can run raw git commands by pressing : in any magit buffer. It opens a commandline prepopulated with `git `, so you can type whatever you want afterwards. The output will appear in the relevant `magit-process` buffer.

(The choice of : is analogous to M-: which will execute an Emacs Lisp expression)