Rebasing in Magit

entropicthoughts.com

202 points by ibobev 20 hours ago


mschulze - 20 hours ago

I use magit daily for over 8 years now. Over that time I have showed it to many other peers, out of excitement for a tool that made me more productive and helped me learn - but I never could convince even one to use it. Maybe it's my persuasion skills, maybe tool usage is too personal - I don't know, but it makes me kind of sad. The UX of magit is just out of this world.

Especially for rebasing, subset rebases (using --onto, see https://git-scm.com/book/en/v2/Git-Branching-Rebasing#_more_...) are a breeze with Magit. I can't remember the order of branches to use on the CLI, in Magit it's just "r s" basically. It's really magic.

jonpalmisc - 19 hours ago

Tangential, but I really wish there would be a performance renaissance with Emacs.

Native-comp was a good step forward, but Emacs is still so much slower than Neovim, even in the case of launching and immediately quitting, with no config:

    $ time emacs -Q -e kill-emacs
    /Applications/Emacs.app/Contents/MacOS/Emacs -nw -Q -e kill-emacs  0.18s user 0.03s system 98% cpu 0.213 total
    
    $ time nvim -es --cmd 'vim.cmd("q")'
    nvim -es --cmd 'vim.cmd("q")'  0.02s user 0.01s system 82% cpu 0.034 total
Even with a very minimal set of packages, text insertion, etc. is slower, and opening Magit (when it hasn't been loaded yet) takes about a second due to slow package loading.

Emacs is my favorite editor, full stop.

But every time I open Neovim or Sublime for quick tasks, it's always painfully apparent how much faster they are when I CMD+Tab back to Emacs.

chriswarbo - 18 hours ago

I've been using magit for years, and it's the reason I avoided giving the jujutsu VCS a try: the `jj` workflow/UI is supposedly much nicer than the `git` workflow/UI; but since I use magit more than bare `git` commands, that wasn't enough to sell me.

I finally gave it a try when I came across the majutsu package, which is a magit-like interface for jujutsu. I recommend it for Emacs/magit users wanting to try `jj`!

jwr - 18 hours ago

One of my favorite magit tricks: cF (commit with instant fixup).

This lets you add a single-line change to a commit way back somewhere in the log.

tambourine_man - 20 hours ago

Magit is one of the few things that makes me, as a Vim user, envy Emacs. And org-mode, since I'm being honest.

tom_ - 7 hours ago

Possibly related: this post about Lotus 1-2-3: https://news.ycombinator.com/item?id=47279633

The Emacs interface in general isn't massively like Lotus 1-2-3's, but magit's somewhat is. The above post goes into a bunch of detail, but what I remember most about my time using 1-2-3 (a long time ago now) was that the shortcuts were super easy to get accustomed to, because there was a prompt of some kind every step of the way. magit's rather similar prompts work well in this respect too. (Though you do still have to know how to use git. This is git, after all.)

Where there might be some more general overlap with Emacs: an apparent goal of Lotus 1-2-3 was, like Emacs, that its users would be able to automate it, and without too much bother given their knowledge of how to operate it in general. It's actually better than Emacs in this respect, because the macros seemed to be largely based on the keys you press; Emacs, by contrast, makes you jump through some hoops to figure out what the corresponding elisp for some sequence of keys might be. (The hoops are not hard to jump through! But they are there.)

(Along similar lines: Autodesk's Maya. And, to an extent, 3D Studio Max - though the scriptability there felt merely comprehensive, rather than pervasive. MaxScript was measurably less horrid than MEL though.)

SoftTalker - 18 hours ago

Magit is absolutely the only reason I'm able to use git. And even at that it's still confusing. Yes I know tens of thousands of devs use it every day. I've got some kind of mental block with git. I used to use Mercurial and Subversion without any issues.

shpx - 19 hours ago

I want to quit Magit because it's unbearably slow. In a repo with 6000 files `git status` takes 100ms but the Magit equivalent takes 2-4 seconds.

haskman - 5 hours ago

Vim/Neovim users should look at LazyGIT. https://www.youtube.com/watch?v=CPLdltN7wgE

The best part - it's a TUI program that's usable independently, that also happens to embed really well within vim.

codingcareer - 19 hours ago

A couple years back I was tinkering with a spacemacs setup and I loved Magit!

Over the years I opted to substitute most tools with simpler, UI-based ones (like LogSeq for org-mode) but I never found a good substitution for Magit.

Having a whole spacemacs setup just for one tool is a bit overkill though, so I just use basic git and accept having to deal with interactive rebases manually.

jwr - 18 hours ago

Magit is absolutely wonderful. It is one of the main tools I use daily to get my work done, especially now that AI does a lot of the work for me. I spend a lot of my time in magit looking at diffs!

I would encourage anyone who relies on magit to sponsor tarsius to make his fantastic work sustainable.

antonyh - 19 hours ago

I bounced for a while between Magit and Tig, then ended up just using whatever the IDE provided combined with the CLI. I'm a frequent-but-not-daily Emacs user, so it boils down to the friction of switching tools. I should give up the Jetbrains IDEs and go all in on Emacs.

nopurpose - 20 hours ago

I was missing magit, but then found `gitu` CLI and now use it happily for rebasing.

- 19 hours ago
[deleted]
skydhash - 20 hours ago

Magit does give you a surgeon control over the scapel that git is. Most git GUI wants to give you a nice dashboard. The latter is OK if you just want some logs stored (aka git commit and git push), but version control can be a powerful tool especially considering how non linear programming can be.

A patch is an idea, not some snapshot of time. git allows for ideas manipulation. The rebase operation is adjusting ideas to fit a context. And with the reflog (which tracks every operations), you have undo for ideas manipulation.

skrebbel - 19 hours ago

Ilove everything about this post.

"It's super easy! Just do l-Akqr␍=u2025-06-01␍-s--tests␍b!"

sandinmyjoints - 20 hours ago

Rebasing in magit is so choice. I especially love magit-rebase-subset.

gnuduncan - 19 hours ago

magit is still my best firend in emacs :)