I wish magit-forge [0] had more features though - like I cannot create new labels from it.
Please consider donating [1] to the developer if it has made your life any easier.
I wish magit-forge [0] had more features though - like I cannot create new labels from it.
Please consider donating [1] to the developer if it has made your life any easier.
It’s not hard (`git add -p`) unless you need line-wise selection.
The main issue in my experience is that it’s completely linear so you need perfect memory and to never make any mistakes: git shows each hunk individually and tells you to make your choice before it shows the next, no take-backs.
Magit shows the entire diff and lets you jump around, and selectively unstaging is just a “d s” away.
As someone without perfect memory and makes mistakes, I consider git add -p ergonomics very user unfriendly. But I guess that's your point :)
I also routinely use line-wise selection and often revert unnecessary lines when crafting the index.
That requires finishing the current staging, moving to unstaging, processing the unstaging (also a linear hunk-wise process), restarting the ataging, and remembering to skip the stuff you’d mistakenly staged.
The workflow of magit is much easier here, and the staging / unstaging integrates very well with reviewing the local or staged diff. Crafting good commits has way less friction and error recovery is much better.
For example, the fact that you can just jump around the buffer and stage/unstage things as you go, means you're free to use whatever you most like for that "jumping around" part. Incremental search? Sure. Ace-jump? Yes. M-x occur? If you must.
Magit on a bare-bones Emacs is extremely ergonomic on its own, but if you use and adapt Emacs for yourself, all the improvements compound on each other.
- some people swear by the integration of Git into IntelliJ or other JetBrains IDEs, which is pretty good (but personally i don't really like it)
- others enjoy a Visual Studio Code plugin or two that provides a vaguely similar and enjoyable user experience
- personally, i rather like completely separate Git GUIs, like Git Cola (https://git-cola.github.io/), SourceTree (https://www.sourcetreeapp.com/) or GitKraken (https://www.gitkraken.com/)
- of course, there's also a group of people who prefer more text based approaches (Vim or Emacs plugins?)
- and there are those that enjoy using the CLI because to them it feels like the most "true" option with the least leaky abstractions
Personally, i think that you should use whatever you feel the most comfortable with and let the people around you do the same.In my eyes, however, staging/unstaging/discarding changes to particular lines or chunks of code, as well as having visual diffs is a really useful use case for GUI solutions of any sort.
What is Tig?
Tig is an ncurses-based text-mode interface for git.
It functions mainly as a Git repository browser, but
can also assist in staging changes for commit at
chunk level and act as a pager for output from
various Git commands.EDIT: also, it isnt 'line-by-line'. Its logical-chunk-by-logical-chunk. The algorithm will try to group local changes together and you need to explicitly tell it to split the chunk up if it is over eager.
The hunk algorithm is not very good in my experience and following the prompts to split them is just about as nice an experience as editing files with `ed`.
Have you tried using a GUI or an editor that supports staging selected lines?
git add -p
Then you can decide if each hunk is staged or not.
Just select any parts of the diff using regular edit text select commands and press "s" for stage.