Hacker News new | ask | show | jobs
by bobz 5080 days ago
Wow, just learned git add -p

That is fantastically useful.

*(Walks you through "hunks" (finer granularity than files) and asks if you want to stage them.)

1 comments

While useful, it's very dangerous in that it's serendipitous to make a commit that breaks building the project, which in the future will break building the project when checking out old commits, or introduce some subtle bug, which breaks other tools like bisect.

Just a personal preference, but I strongly prefer being able to build (and test) every commit in the entire history.

So after you're done, go back through the commits and run your build tests.

https://www.destroyallsoftware.com/screencasts/catalog/sourc...

  git add -p
  git commmit
  git stash
  build && test
  git stash pop
  rinse && wash && repeat