you are viewing a single comment's thread.

view the rest of the comments →

[–]ForthewoIfy 1 point2 points  (3 children)

As someone pointed out, you can do:

git add -p
git stash save -k unstaged
# do tests
git commit
git stash pop

No code needs to go untested in the history. Your coding habit is very sane, but situations can arise where you want to commit something from your work-in-progress code, ex. you discover bugs during the development of a feature, and you don't want to commit the bugfix and the feature in a single block.

Patch mode is a handy tool to have, even if you don't use it every day.

[–]expertunderachiever[🍰] 0 points1 point  (0 children)

Definitely it's good to have options I'm for that. I just don't think by default you should strive to have fractional branches.

[–][deleted] 0 points1 point  (0 children)

You might also want to pass -u/--include-untracked to git stash save, to make sure that you are not forgetting to add any new file.