Hacker News new | ask | show | jobs
by tbabej 1805 days ago
> Commiting hunks on command line is tedious afaik. You would have to specify row numbers.

Not necessarily tedious - you can just use "git add -p" to stage hunks individually.

2 comments

`git add -p` is nice, but Magit's UI is superior, IMO.

I don't know a way to stage individual lines from a given hunk separately in Git's interactive add, but in Magit's that's easy - just select the line you want and press s.

I've even occasionally staged part of a line via selection, when I've actually had two distinct bugfixes on the same line.

Iirc you can edit the patch in git add -p. So fine editing is possible.
In Magit you can easily select arbitrary regions of code to stage (or chunks as you would via the command line). I haven't seen any git interface that is as intuitive for this task.
Try pressing `S` in `tig`. Works like magit but is much faster(when I say faster I'm also including interface lag). I realize that you won't switch, nor do you need to, but the general things people suggest of why magit is superior exist elsewhere as well.
Thanks for the tip, I haven't tried tig yet. That might actually be useful on remote systems in situations where I don't have access to my personally configured emacs.
Why just not use TRAMP to use your personal emacs to edit files on remote systems?
I actually use the git-gutter.el package alongside magit to do the arbitrary region work, and find it to fill the last gap between magit and the built-in version control commands.