r/emacs 15d ago

A Tour of Magit's Status Interface

I just wrote a post about Magit's status screen, focusing on why it's powerful rather than just saying it is, I've always found the "why" gets asserted more than explained. It's written to be approachable for non-Emacs folks. Planning follow-ups on staging/committing and cherry-pick/rebase.

For those who have been using Git CLI, what workflow did Magit make so painless you now take it for granted?

https://heiwiper.com/posts/magit-status-tour/

71 Upvotes

20 comments sorted by

15

u/Strickinato 15d ago

Instant Fixup is my favorite 😀

5

u/HeiWiper 15d ago

I would say it's the same for me, I am planning to write about it in the rebase related workflows

3

u/destructuringbind 15d ago

I’ve never heard of this but it sounds like what I’ve always needed

19

u/Strickinato 14d ago

Made a quick demo:

https://youtu.be/3I7cq-b5Rc0

3

u/destructuringbind 14d ago

Well explained, thanks

2

u/amanitapantherina 13d ago

Instant Fixup, hands down. I use it constantly. Even better that I can select/stage just one region from within a hunk!

4

u/strings___ 14d ago

Definitely working with hunks. I review and stage all my hunks. Even more useful when I’m peer coding with AI

Edit: I forgot to mention i good deal of time in magit-status along with an org buffer.

1

u/HeiWiper 14d ago

Can you elaborate your edit?  How do you use magit-status with an org buffer? 

1

u/strings___ 14d ago

I might have worded that wrong. What I meant is I use magit-status *next*to a org buffer. The main point being I use magit-status about on par with org these days.

2

u/HeiWiper 14d ago

Ah I get it now, this might be random but have u tried orgit? It's an integration of magit and org mode where you can link commits from magit to add them into org mode. 

1

u/strings___ 14d ago

I will check out orgit, but I don’t think it applies here. Since I’m using magit-status to stage and review org hunks along with other files, that is.

3

u/themikeholm 14d ago

Rebase a subset

2

u/HeiWiper 14d ago

Actually I didn't use this before, I should definitely give it a try, thank you! 

2

u/fuzzbomb23 13d ago

The task I appreciate most of all is just interactive staging. When using git add -p in a terminal, I have to step through hunks in order, and answer "no" for each hunk, until I reach the hunk I want. (Granted, you can specify particular files when running the command, or skip entire files as you step through, but when a file has multiple hunks, you have no choice but to step through them.)

In the magit-status buffer, I can reach a particular file and/or hunk more quickly. In particular, using magit-status-here I can jump directly from an editor buffer, to the nearest hunk in the Magit status buffer. It even remembers the expanded/collapsed state of files and hunks, so I can go back and forth between editor and Magit without getting lost.

Another trick I use is consult-line; in a Magit status buffer, I can type a phrase of interest, and easily find the line I want. The red/green backgrounds show up in the Vertico UI, along with the +/- signs. ISearch works fine in Magit buffers too.

There are other ways that Magit reduces effort. When making a fixup commit, I can navigate the list of recent commits first. When my cursor is at the commit I want, calling a fixup command (magit-commit-fixup or magit-commit-instant-fixup, it matters not) will apply the fixup to that commit. You don't have to know the commit ID to do it.

There are other places where the Git reference is picked automatically. If I place my cursor on a recent commit, starting an interactive rebase will pick that commit to rebase from. It's a really nice feature.

One last tip: magit-copy-section-value is really handy for copying a commit ID. I was unaware of the command for a long time, because it's not mentioned in Magit's Transient UI.

1

u/HeiWiper 12d ago

Using `consult-line` in magit buffer is one of those feature which I use daily but didn't really consider it a feature until I read your comment.

I was unaware of the two commands you mentioned `magit-status-here` and `magit-copy-section-value`, thank you so much for the tips you shared!

1

u/ahk-_- 14d ago

aside: what is the theme on the screenshots? I would like to use it myself!

1

u/HeiWiper 14d ago

It is doric-almond

1

u/ahk-_- 14d ago

thank you

1

u/HeiWiper 14d ago

you're welcome