Reputation: 45028
We're using a A successful Git branching model by Vincent Driessen for our branching model. All's fine but I haven't really seen a particular issue brought up.
From what I've understood, when a new feature is required, you branch of the development
and create a new feature
branch. You would work on this and when you're done, you would merge this branch into the the development
branch.
What if a developer makes a feature and then merges that feature back to development
only to be found out that there's some bugs in the feature code. Where should this be fixed? Should a new fix
/bugfix
branch be started from development and the code be fixed there? I can't see another way.
How should one go about this?
Thanks
Upvotes: 11
Views: 11614
Reputation: 11963
How about finding the commit that introduced the bug, and creating a new branch rooted there? With this approach:
Upvotes: 5
Reputation: 3251
Remember that a model is just a model - it's about giving you a structure that makes you more efficient, not blindly following a set of rules. That means that you should feel free to tweak things and figure out what works in your situation, because it may not work in every situation.
I think you have a choice in this situation:
Which one you choose depends on factors like:
The difference between a feature branch and bugfix branch isn't important from Git's point of view. It only matters if you use those labels for internal documentation or other auditing purposes (e.g. to keep track of what is visible to external users).
Resist the temptation to work straight off the development branch even if you think the bugfix will be very quick - nothing is ever quite as simple as it seems, and you will give yourself a headache later if anything goes wrong.
Rough visual representation of your choices:
Upvotes: 12
Reputation: 26910
Just make a branch (or use the old, merged feature
branch) and fix it there.
Using the old branch / create new branch is just the same --- you can't name which is which after merged.
Upvotes: 0
Reputation: 1325195
If that feature branch is a public one (i.e pushed to a remote repo which is cloned / used by others), it is best to make a new branch and isolate the debug in said fix branch.
(instead of trying to rebase 'feature
' branch on top of 'develop
' branch).
The idea remains to not record intermediate debug commits directly in develop
branch, but to record only the resulting commit that will fix the bug introduced by feature
branch merge in the first place.
Upvotes: 1