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

I don't always commit as often as I should, but ever since reading Ryan Tomayko's "The thing about git"[1], I use git add --patch/-p to solve the problem of overlarge or mixed commits. It allows you to snip out pieces of the changed files to add, rather than adding the entire file at once. (Perhaps everyone already knows this, but I used git for months without knowing it. So maybe I'll save someone else.)

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



I agree Tomayko's method is very helpful, but I came to the conclusion it's better to just commit as often as possible.

- Multiple changes that affect the same line(s) are very difficult to pick apart.

- It is easier to write a meaningful commit message while the change is fresh in your head; otherwise a lot of time is spent reviewing your changes.




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

Search: