Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

git-add -p is new to me, but looks like something I'd wish I'd known about for a long while. The number of times I end up copying changes (like a new function) into some temp file while I commit is more than I'd care to admit.


Another good post that talks about git add -p is Ryan Tomayko's The Thing About Git[1].

[1]: http://tomayko.com/writings/the-thing-about-git


You can also git-add -i to go through the staging area & stage/unstage individual patches.


Or use git citool or an emacs mode like egg or magit (other editors have similar) that let you conveniently stage by hunk or line.


you can use git gui (included) for a mouse-friendly way of doing this.


Since I first tried the Git GUI I can't see myself using Git Bash ever again (and this article reminds me of why).


If you are on a mac, Gitx works nicely too. You can see each file, and state "hunks" as you go.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: