Hacker News new | past | comments | ask | show | jobs | submit login

Within 'git add -p' when you get to the hunk that you want to edit (split down to single lines), press 'e'. This will open an editor (vim in my case) which lets you edit the diff manually.

In there you can remove added lines (prefixed by '+') by removing them, and re-adding removed lines (prefixed by '-') by replacing the '-' with a space ' '.




And how is this faster/better than selecting a line with the mouse and pressing s without opening any other editor?


Do it in Vim (or emacs for those weirdos out there) and you're done before you would've even reached the mouse :)


Sometimes your changes are across multiple files, and it's easier to say, "yes, yes, yes, yes, split, no, no, yes, ..."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: