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

git add -p



Not a gui, and rather painstaking. With gitg you single click on lines in changes (green added, red removed) which selects them. You can separately click on as many disjoint ones across as many hunks as you want. There is a 'Discard Selection' button which removes the highlighted lines from the code, and a 'Stage Selection' to add those lines to the index.

While git add -p is in theory doing something similar, it is a lot more painful to use, and you are still working a hunk at a time instead of just scrolling through changes.

I often use this functionality when I've made a number of changes during development and everything is now coherent, especially on a multi-language project. It is then easy to go in and discard lines that were added to debug, and stage lines across multiple commits so they are logically grouped.




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

Search: