Live data from Hacker News

Magit, the magical Git interface (2017)

emacsair.me

191–200 of 357 posts

Re: Magit, the magical Git interface (2017)

#191
post #98

I use git from the command line, so this looked like a tool i would use. I was able to install it with apt, but i could not find any information on how to run it. Manual says "C-x g" [1], which obviously does nothing in bash. And I have no idea how to use emacs. Is there any helpful user manual? Should i give up on magit? [1] https://magit.vc/manual/magit/Getting-Started.html

Stay with it! I would suggest you launch emacs with a file in the repo, ($ emacs ) and then run magit, "C-x g".

Then you're in the magit window with menus and prompts and so forth.

Re: Magit, the magical Git interface (2017)

#192

I've never seen the upside. I use Emacs as my primary editor, and I regret it every time I say "today is the day I start using Magit". It is exceedingly invasive, triggering itself even when you don't ask for it (like running "git rebase -i" on the command line). The invasive stuff changes how the text editing itself works, but doesn't add deep features. In the interactive rebase case, I lose the ability to treat the…

Just to clarify, does emacs/magit really pop up when you run "git rebase -i" on the command line? I haven't experienced this, but maybe that's because my EDITOR env var is set to "vim". I would find that very annoying.

I like magit, but I never figured out the rebase flow with it, so I just do that on the command line.

Where magit really shines for me is being able to stage and unstage hunks of code very easily. Looking at my current changes, stashing and un-stashing, searching through git log, seeing the diff of a particular commit, quickly fetching from upstream or switching branches... All of that becomes quick and easy once the key bindings become second nature. There are definitely major quirks of the UI / UX, but I found it worth fighting through that.

edit: I've re-read your post again, and I would just like to reiterate that staying away from magit's interactive rebase might be a good idea. Besides that, I also try to stay away from triggering ediff mode -- even after spending time with it and getting to know how it works, I've decided that it's simply not very good.

Re: Magit, the magical Git interface (2017)

#194

I've never seen the upside. I use Emacs as my primary editor, and I regret it every time I say "today is the day I start using Magit". It is exceedingly invasive, triggering itself even when you don't ask for it (like running "git rebase -i" on the command line). The invasive stuff changes how the text editing itself works, but doesn't add deep features. In the interactive rebase case, I lose the ability to treat the…

Ah, for me it doesn't invade the command line at all, perhaps because I don't have emacs set as $EDITOR?

I use emacs as my daily driver also, however if bash wants an editor it's usually a small task, so I'm just as happy to use vim or nano. Most often I can't install emacs on remote servers anyway.

Re: Magit, the magical Git interface (2017)

#195

Earlier quoted context omitted.

This creates a new commit that reverses the changes of a past commit. That’s different from undoing your last commit, as in, you made a commit but then changed your mind, and want, say to make some more changes before you commit. (Explained in man git-revert.)

That's by design; Git history is intended to be immutable when working with others. But, if you haven't pushed something up to a remote, the right command to make more changes is to use `git commit --amend`.

> Git history is intended to be immutable when working with others.

That's another pet peeve (though maybe less git's fault): immutable, yes, but then rebase is pushed quite liberally. Arguably not by git itself, but by many online learning resources.

It's convenient, and mostly works, but then occasionally really stings you.

...yet undoing the last commit, arguably the least aggressive of history-rewriting commands, remains awkward.

Re: Magit, the magical Git interface (2017)

#196

I've never seen the upside. I use Emacs as my primary editor, and I regret it every time I say "today is the day I start using Magit". It is exceedingly invasive, triggering itself even when you don't ask for it (like running "git rebase -i" on the command line). The invasive stuff changes how the text editing itself works, but doesn't add deep features. In the interactive rebase case, I lose the ability to treat the…

Just to clarify, does emacs/magit really pop up when you run "git rebase -i" on the command line? I haven't experienced this, but maybe that's because my EDITOR env var is set to "vim". I would find that very annoying. I like magit, but I never figured out the rebase flow with it, so I just do that on the command line. Where magit really shines for me is being able to stage and unstage hunks of code very easily. Look…

> Just to clarify, does emacs/magit really pop up when you run "git rebase -i" on the command line? I haven't experienced this, but maybe that's because my EDITOR env var is set to "vim".

It would only pop up from running `git rebase -i` (or whatever) if your $EDITOR is set to emacs. I'm a heavy emacs/magit user, and even I find the idea of setting my $EDITOR to `emacs` abhorrent.

Re: Magit, the magical Git interface (2017)

#197

I've never seen the upside. I use Emacs as my primary editor, and I regret it every time I say "today is the day I start using Magit". It is exceedingly invasive, triggering itself even when you don't ask for it (like running "git rebase -i" on the command line). The invasive stuff changes how the text editing itself works, but doesn't add deep features. In the interactive rebase case, I lose the ability to treat the…

For your everyday stage->commit->pull->push I think magit is damn near perfect. Staging individual files, or even individual blocks is simple and not verbose (unlike cli equivalents). Picking out eg. problems with my gitignore I find to be easier while looking at the magit status page as well. I think conflict resolution also bears looking at.

For other things... you'd have to ask somebody else. I generally do any type of branching or merging or similar using the git cli, and that's part of the beauty of magit: she doesn't care when I cheat on her that way.

Re: Magit, the magical Git interface (2017)

#198
post #95

Earlier quoted context omitted.

You can, but it will be worth it for you to spend a little effort to learn the basic buffer, window, and cursor management keystrokes. My 12 year old uses magit as a git interface and nothing else in emacs. That’s not a great testimonial as it was my direction to do that, but it seems to work just fine. The areas where magit earns outsized praise is not around a basic “pull, add and commit everything, push” workflow,…

> but rather around being selective about crafting self-consistent but single-theme revisions Actually, I think git's got Magit beat on that. Magit might make it easier to stage specific lines, but git can stage specific parts of lines or even changes that are completely different than what's on the worktree, through the editing of diffs with `git add -p`'s `e` option.

Magit has great support for staging parts of lines - select the section you want to stage and press 's'.

Re: Magit, the magical Git interface (2017)

#199
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,…

Can I like magit if I don’t like emacs?

There's a VSCode plugin based on magit. In my experience, it's basically identical (though occasionally a bit slow when there's lots of files).

https://marketplace.visualstudio.com/items?itemName=kahole.m...

Re: Magit, the magical Git interface (2017)

#200
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,…

Can I like magit if I don’t like emacs?

I used my own emacs for several years, then switched to Spacemacs. It's far easier to learn and use for most people, and also works with Vim keybindings. I'd recommend giving it a try.
Post reply on HN