git - What is best practice for updating feature branches to a new base? -
i use git flow , have question best practice when branching making feature branches. if have develop main branch , 2 feature branches, 1 branched @ time t2 , other branched @ t3, should done if both feature branches not ready merge , need new develop branch or other feature branch? there way update "base" of feature 1 develop @ t2 new "base" of develop @ t3 when new has been done develop? , feature branch 2, when not ready merging, can updated new changes develop branch before merge it?
feature 1 (branch) / / ----- develop ----/-----\--------------------------- \ \ feature 2 (branch) t1 t2 t3 t4
can branches somehow "moved forward" new changes in develop branch included feature branches or necessary merge first?
i want complement 2 existing answers: instead of merging develop
in feature
branches, instead rebase each feature
branch on updated develop
branch:
git checkout feature git rebase develop
advantages:
- the history becomes clearer, because avoid merge commits such merge branch develop feature, may confusing when you're later merging
feature
develop
. - additionally, can change commits in
feature
branch (e.g. if want fix typo in commit message) without changing commits indevelop
branch. if mergedevelop
feature
, no longer possible, because branches diverge , can no longer mergefeature
develop
.
so approach more work (rebase instead of merge), brings (minor) advantages.
Comments
Post a Comment