Re:Oh shit, git: Getting myself out of bad situations
by dasil003 on Monday December 18, 2017 @12:16PM
(#15953238)
Say you have 3 sequential lines, but you only want to stage the middle one. You can’t split it into smaller hunks by hitting ‘s’ during ‘git add -p’. I’m sure there’s a way I’m just not familiar with but I just use Sourcetree for this on the rare occasion it occurs.
[ Parent
| on HN ]
Re:Oh shit, git: Getting myself out of bad situations
by klmr on Monday December 18, 2017 @12:38PM
(#15953457)
You can split hunks manually by editing (hit “e” instead of “s” during staging). I end up doing this fairly regularly.
Re:Oh shit, git: Getting myself out of bad situations
by rickycook on Monday December 18, 2017 @06:19PM
(#15956356)
i think that’s his point? there’s a huge amount of useful, but advanced functionality in the git CLI
Re:Oh shit, git: Getting myself out of bad situations
by jgtrosh on Monday December 18, 2017 @06:49PM
(#15956560)
As mentioned before, manual edits can be made at that point. However I'll add that for this use case, a tool integrated in your editor will often be more adapted to manual staging. I have Tim Pope's vim-fugitive plugin in mind which is a quite wonderful way of using Git.