Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've started using gitflow for a project, and I have an outstanding feature branch as well as a newly created hotfix. Per the gitflow workflow, the hotfix gets applied to both the master and develop branches, but nothing is said or done about extant feature branches.

Nevertheless, I'd like to incorporate the hotfix changes back into my feature branch, which as near as I can tell leaves three options:

  1. Don't incorporate the changes. If the changes were needed for the feature branch, it should've been part of the feature branch.
  2. Merge develop back into the feature branch. This seems to follow the gitflow workflow the best, but would cause out-of-order commits.
  3. Rebase the feature branch onto develop. This would preserve commit order but rebasing seems to be completely absent from the general gitflow workflow.

What's the best practice here?

share|improve this question
    
Feature branches are generally supposed to be very short-lived, it's kind of an SCM smell to be merging changes into them; is it impossible to just finish (or stabilize) the feature branch and merge it back? –  Aaronaught Sep 2 '12 at 0:54
    
@Aaronaught well the feature's not done/may go nowhere. The basic situation is that a feature that's taking a couple of days to develop uncovered a bug that could potentially affect production data. Tests were written, hotfix applied to master/production, but the unfinished feature is still broken by the bug. Are you suggesting merging a half-completed feature into the development mainline? What happens if the feature doesn't pan out? –  user8 Sep 2 '12 at 1:01
add comment

1 Answer

up vote 6 down vote accepted

I don't see anything wrong with rebasing your feature branch onto develop to pick up the latest hot fixes. Actually, frequently rebasing your feature branch against develop can be helpful, since it lets you keep your branch "up to date," which makes merging much easier when you get to that stage.

share|improve this answer
    
Yeah: looking around some more, circumstantial evidence—including the gitflow 0.2 announcement which added feature rebasing—is pointing to the regular git rebase workflow being the gitflow workflow as well. –  user8 Sep 2 '12 at 1:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.