This question pertains not only to how to accomplish this task, but to whether doing so is good or bad practice with Git.
Consider that locally I do most work on the main
branch, but I have created a topical branch I will call feature_branch
. In the process of working on feature_branch
and switching back and forth to do other work on the main
branch, it turns out that I have made more than one commit on feature_branch
, but between each commit, I have done no push. My questions are:
Would you consider this bad practice? Would it not be wiser to stick with one commit per branch per push? In what cases would it be good to have multiple commits on a branch before a push is made?
How should I best accomplish bringing the multiple commits on
feature_branch
into themain
branch for a push? Is it a nuisance to not worry about it and just do the push where multiple commits get pushed, or is it less annoying to somehow merge the commits into one and then push? Again, how to do this?