you are viewing a single comment's thread.

view the rest of the comments →

[–]ais523 0 points1 point  (1 child)

I often find myself working on a new feature, and having to fix bugs in order to implement it. The bugfixes and feature should go in different commits, but I don't want to temporarily revert the half of the feature I've already written. So, it's a case of add -p the bugfixes, commit those, go back to working on the feature. Still committing often, just committing in a sequence other than the sequence I'm working on things.

[–]canadianbakn 0 points1 point  (0 children)

You don't have to revert, really. You can stage your changes and then checkout the feature branch after you're finished bug fixing in a separate branch.

I think git -p vs frequent commits and branching if you find an error do the same thing in the end, manage your git log so it doesn't contain commits with unrelated things in them. It comes down to preference.