9 ms·
I may be in between the GUI and CLI camps. I actually use git via a TUI (text user interface) by using vim to either read from or write to git commands. I can
by u801e 5y ago
I may be in between the GUI and CLI camps. I actually use git via a TUI (text user interface) by using vim to either read from or write to git commands.
I can stage hunks by yanking the diff header (excluding the line that starts with @@) and pasting it above the hunk I want to stage and then filtering the hunk through:
:'<,'> !git apply --cached -
If I want to unstage it, I can press u to restore the hunk I just filtered and then run
:'<,'> !git apply -R --cached -
I can commit from within vim by reading the verbose status output by running:
:r !git status -v
typing my commit message at the top and filtering it through
:'<,'> !git commit -F -
> Does any GUI offer `-p` in `git commit` and `git stash`? I literally use it 10s times per day, can't live without it once I started using it.
In addition to what I wrote above using git apply --cached, I can actually edit hunks from within vim and then filter the hunk (with the diff header) through the recountdiff utility that comes with patchutils. That basically updates the numbers in the line that starts with @@ to account for the changes in the number of added and removed lines introduced by the edit. This way, I can stage my changes and still exclude extraneous changes or debug statements I've added to the code.
I've actually found this to be a better experience compared to using the -p option.