My favorite feature in magit is the ease of doing block and line level staging of hunks. It's normal in my workflow to touch on code unrelated to what I'm working on, fixing a typo here, a formatting fix there, refactoring or simplifying a statement that was unclear at first glance.
Staging those changes and commiting them right away if there are more working on the code base or simply staging them as a separate commits when the current task done makes it so much easier to keep a clean history - without having to do intermediary commits or stashing.
The feature is called git add --patch[0] in command line git but magit makes it so much more accessible.
> My favorite feature in magit is the ease of doing block and line level staging of hunks.
Doing so is also easy using command-line git (add -p, commit -p and hunkwise reverts with checkout -p), the great thing about magit is it lets me do so:
1. with a bird's eye view, git's <x> -p shows hunks independent from one another and asks me what I want to do, sometimes I have no idea because I don't really remember what the context of that change is (or if there is one)
2. nonlinearly, similarly to above git's <x> -p goes through each hunk one by one, in magit I can go back and forth in the diff buffer if I need more info, there are shortcuts to process it linearly but it's a help (because that's a common case) not a limitation of the tool
Staging those changes and commiting them right away if there are more working on the code base or simply staging them as a separate commits when the current task done makes it so much easier to keep a clean history - without having to do intermediary commits or stashing.
The feature is called git add --patch[0] in command line git but magit makes it so much more accessible.
[0] https://git-scm.com/docs/git-add#git-add--p