Вопрос

Let's assume that I am working on a small project that uses feature branches to organize tasks. For example, feature/login would be for working on the login functionality and feature/create-new-post would be for adding functionality to allow users to create new posts. When a feature branch comes to a relatively stable stopping place, it gets merged into development which is an up-to-date-ish version of the codebase.

Now let's say I find a typo in a comment in some file. This file is quite generic and doesn't really fit into one particular feature branch. If I am working away in feature/login when I discover this, what branch should I commit this fix to? I feel that it would be wrong to commit to feature/login because the typo is completely unrelated to login functionality. It also feels wrong just to commit directly to my development branch because that isn't usually the process.

Note - this is (pretty much) a hypothetical, I'm wondering what the cleanest solution in general would be.

Это было полезно?

Решение

I've seen a number of different approaches:

Submit with feature

Although it doesn't belong in the feature code per se, it is simply added to the feature branch as long as the risk is low.

Submit on separate branch

For larger or more riskier changes, it may be prudent to have a separate branch.

Submit on child branch

Admittedly quite rare, but a change might be triaged and the change made on a child branch with a view to merging this into a later feature branch.


For trivial changes, it can be tempting simply to merge this into development but it is worth at least discussing this with peers first to set the ground rules. I've seen many a trivial change break builds and the fall out is usually more painful than simply putting it into a branch.

Лицензировано под: CC-BY-SA с атрибуция
scroll top