News for hackers. Stuff that matters.
Re:A work-in-progress Magit clone for Neovim by zelphirkalt on Thursday July 08, 2021 @07:23AM (#27770558)
> Why learn how to use git with Emacs/magit, vim, IntelliJ IDEA, Eclipse, Visual Studio / Code, ... when you can just master the official command line client and forget about the rest?

Because it is faster, has great visualization and most importantly magit has great fallbacks. You can still use the command line from magit! Pressing "!!" in a magit-status buffer will get you there, while still showing you all the nice info in the other buffers. I use it for "git submodule update --init --recursive" for example.

I have seen people struggling with git log and understanding which commit is on which branch and all that. Of course you can use something like "git log --decorate --graph --color --oneline --all" or even alias that. In magit I do: "mag-stat" (Emacs completes this to "magit-status") which one does usually anyway, to see where the repository is at and whether there are uncommited changes and so on. When I need the graph, I do: "mag-log" "-" "c" "b". Then I can go to any line in the graph and check it out, because it becomes the default for when I type "mag-check" (completed to magit-checkout) and press RET. On command line I would be copying commit ids and branch names and would remember to use my alias for the long git log command.

Edit: Another great feature is how easy it is to commit only some hunks, instead of everything that has changed. Commiting hunks on command line is tedious afaik. You would have to specify row numbers.

Re:A work-in-progress Magit clone for Neovim by tbabej on Thursday July 08, 2021 @08:00AM (#27770812)
> 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.

Re:A work-in-progress Magit clone for Neovim by NateEag on Thursday July 08, 2021 @08:18AM (#27770965)
`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.

Re:A work-in-progress Magit clone for Neovim by scooble on Thursday July 08, 2021 @10:14AM (#27772202)
Iirc you can edit the patch in git add -p. So fine editing is possible.
Re:A work-in-progress Magit clone for Neovim by rerx on Thursday July 08, 2021 @08:14AM (#27770928)
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.
Re:A work-in-progress Magit clone for Neovim by rjzzleep on Thursday July 08, 2021 @09:16AM (#27771543)
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.
Re:A work-in-progress Magit clone for Neovim by rerx on Thursday July 08, 2021 @09:46AM (#27771878)
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.
Re:A work-in-progress Magit clone for Neovim by fouric on Thursday July 08, 2021 @01:39PM (#27775346)
Why just not use TRAMP to use your personal emacs to edit files on remote systems?
Re:A work-in-progress Magit clone for Neovim by xemdetia on Thursday July 08, 2021 @11:42AM (#27773449)
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.
Re:A work-in-progress Magit clone for Neovim by I_complete_me on Thursday July 08, 2021 @04:46PM (#27777385)
As a side note, I am struggling to be comfortable with the word hunk in this context. I would automatically use the word chunk for this usage need. Magit introduced it to me and I balked at the usage. I looked up the etymology and it seems to be a totally legitimate usage - [0]- but to me the word 'hunk' immediately conjures up - as a heterosexual - attractive, sexually appealing man. [0] https://www.etymonline.com/search?q=hunk