{"id":622,"date":"2010-04-06T17:17:14","date_gmt":"2010-04-06T16:17:14","guid":{"rendered":"http:\/\/blog.eweibel.net\/?p=622"},"modified":"2010-08-19T09:49:34","modified_gmt":"2010-08-19T08:49:34","slug":"branching-practices","status":"publish","type":"post","link":"https:\/\/blog.eweibel.net\/?p=622","title":{"rendered":"Branching practices"},"content":{"rendered":"<p>In an environment where several developers work at the same code base or several features have to be implemented, then branching will be a topic. I was asked to create a branching guide for my current employer which use <a href=\"http:\/\/en.wikipedia.org\/wiki\/Team_Foundation_Server\" target=\"_blank\">TFS<\/a> as source code repository.<\/p>\n<p><strong>Motivation<\/strong><\/p>\n<p>In our projects I found the following problems:<\/p>\n<ul>\n<li>When the developers want to release a new version, not every feature was finished. So they had to deliver unfinished features. To solve that problem, they need to disable the unfinished features by configuration. <\/li>\n<li>Some features which they had to implement were breaking features. In a such case, they were blocked to deliver new fixes or little features. <\/li>\n<li>Sometimes they had to produce a hot-fix for the version which was in production. In a such scenario, they had to take manually the labeled version from the repository and build a hot-fix. After that, they had to copy the fixed code into the current code base. <\/li>\n<\/ul>\n<p><strong>Branching Guide<\/strong><\/p>\n<p>For those three scenarios branching could minimize the impact. So I described in the branching guide the following patterns to solve our problems:<\/p>\n<ul>\n<li>Feature-Branch (and Team-Branch) <\/li>\n<li>Developer-Versions <\/li>\n<li>Production-Branch <\/li>\n<li>Feature-Freeze <\/li>\n<\/ul>\n<p><a href=\"http:\/\/blog.eweibel.net\/wp-content\/uploads\/image3.png\" class=\"lightbox\"><img loading=\"lazy\" decoding=\"async\" style=\"border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/blog.eweibel.net\/wp-content\/uploads\/image_thumb3.png\" width=\"595\" height=\"320\" \/><\/a> <\/p>\n<p><strong>Feature-Branch<\/strong><\/p>\n<p>A Feature-Branch is a branch which is created always from the Main-Branch. It\u2019s important to choose the right granularity for a feature. A worst-case-scenario is when you split a feature over several Feature-Branches, so that they become dependent on each other. A good granularity is for example a module or a workflow (several GUIs), something which is self-contained.<\/p>\n<p>With Feature-Branches you have the possibility the use the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Cherry_picking\" target=\"_blank\">cherry-picking<\/a> method. That means, that before you release a new version, you choose by some quality gates (code coverage, code review, documentation, etc.) which Feature-Branches you want to merge back to the Main-Branch.<\/p>\n<p>A special version of a Feature-Branch is the Team-Branch (not visible in the picture). A Team-Branch is a Feature-Branch which will be reused after a completed feature (and reverse integration to the Main-Branch). A Team-Branch will reduce the number of branches and it is assign exactly to one team or team member. It is also important, that on a Team-Branch it is allowed to implement exactly one feature at a time.<\/p>\n<p><strong>Developer-Version<\/strong><\/p>\n<p>The Developer-Version (in the picture the labels 2.1.2016.1 or 2.1.2016.2) are needed, when you have to create a version of your application or component to deliver it to another team. We had some dependencies of components and for breaking features, all of them were influenced. So we created a Feature-Branch in each component and published for each a Developer-Version. The dependent component could reference that Developer-Version in the corresponding Feature-Branch. A Developer-Version is just for internal use, it isn\u2019t allowed to deliver it to the customer.<\/p>\n<p><strong>Production Branch<\/strong><\/p>\n<p>The Production-Branch is the representation of the actual delivered version of an application or component. In our situation, it wasn\u2019t possible that there were several versions in production. So, we didn\u2019t need for each release a separate branch, we could reuse a branch \u2013 the production branch.<\/p>\n<p>There a two approaches how to refresh the Production-Branch: After the end of the Feature-Freeze, when the new version was shipped. The other possibility is before you create the first hot-fix (refresh with the help of the labeled version).<\/p>\n<p><strong>Feature-Freeze<\/strong><\/p>\n<p>When you have to create a new version, you have to decide what you will or could deliver. After you merged all good Feature-Branches then the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Freeze_%28software_engineering%29\" target=\"_blank\">Feature-Freeze<\/a> begins. During the Feature-Freeze it isn\u2019t allowed to add any features, but it\u2019s allowed to fix the current version. Before the Feature-Freeze ends, you have to release your current version to ship.<\/p>\n<p>When the Feature-Freeze takes a long time, then you have to create Feature-Branches to continue the development for the next version.<\/p>\n<p><strong>Branching and Continuous Integration<\/strong><\/p>\n<p>Branching and <a href=\"http:\/\/martinfowler.com\/articles\/continuousIntegration.html\" target=\"_blank\">Continuous Integration<\/a> aren\u2019t the best friends. With Branching you want to isolate the features from each other, but you pay it when you have to merge. Merging is a manual integration of two versions, and it isn\u2019t always fun to do it.<\/p>\n<p>With Continuous Integration you want to prevent a big bang integration. You want to give the developers as early as possible feedback, that the current code is breaking or not.<\/p>\n<p>In our situation, we had Continuous Integration for the Main-Branch, but not for the other branches. I would recommend to add Continuous Integration for the other branches too if they take a longer time. I would recommend also to forward integrate several times to avoid a difficult merge at the end.<\/p>\n<p><strong>Further Reading<\/strong><\/p>\n<p><a href=\"http:\/\/tfsbranchingguideiii.codeplex.com\" target=\"_blank\">Microsoft Branching Guide III<\/a><\/p>\n<p><a href=\"http:\/\/martinfowler.com\/bliki\/FeatureBranch.html\" target=\"_blank\">Feature Branch by Martin Fowler<\/a><\/p>\n<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/Software_release_life_cycle#Software_development_stages\" target=\"_blank\">Software Development Stages<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In an environment where several developers work at the same code base or several features have to be implemented, then branching will be a topic. I was asked to create a branching guide for my current employer which use TFS as source code repository. Motivation In our projects I found the following problems: When the developers want to release a new version, not every feature was finished. So they had to deliver unfinished features. To solve that problem, they need&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/blog.eweibel.net\/?p=622\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,14],"tags":[],"class_list":["post-622","post","type-post","status-publish","format-standard","hentry","category-good-practices","category-software-engineering"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/plOV9-a2","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1082,"url":"https:\/\/blog.eweibel.net\/?p=1082","url_meta":{"origin":622,"position":0},"title":"Branch or not to branch","author":"Patrick","date":"22. Aug 2011","format":false,"excerpt":"That is a question? Yes, it is a question which you should ask yourself before to create a new branch or reuse an existing branch. There are other practices or possibilities to create new features in an existing software, which I will show in this blog post. Also there are\u2026","rel":"","context":"In &quot;Good practices&quot;","block_context":{"text":"Good practices","link":"https:\/\/blog.eweibel.net\/?cat=5"},"img":{"alt_text":"Fotolia_25836922_S","src":"https:\/\/i0.wp.com\/blog.eweibel.net\/wp-content\/uploads\/Fotolia_25836922_S_thumb.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":835,"url":"https:\/\/blog.eweibel.net\/?p=835","url_meta":{"origin":622,"position":1},"title":"NTimeline project &#8211; First release","author":"Patrick","date":"27. Oct 2010","format":false,"excerpt":"I currently started on codeplex.com an open source project. It was inspired by my last project. In this project I was a lead developer and software architect and the domain was about a social assurance. I was responsible about several developers and also for a product of the assurance-suite. This\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/blog.eweibel.net\/?cat=13"},"img":{"alt_text":"NTimelineLogo","src":"https:\/\/i0.wp.com\/blog.eweibel.net\/wp-content\/uploads\/NTimelineLogo_thumb1.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1264,"url":"https:\/\/blog.eweibel.net\/?p=1264","url_meta":{"origin":622,"position":2},"title":"Migrate a VSS repository to TFS","author":"Patrick","date":"2. Aug 2012","format":false,"excerpt":"Recently I had to migrate parts from a Microsoft Visual SourceSafe 2005 repository to a Microsoft Team Foundation Server 2010 repository. In this blog post I show what I had to do and what the pitfalls were. The tool To migrate a repository you have at least two possibilities: Migrate\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/blog.eweibel.net\/?cat=13"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1154,"url":"https:\/\/blog.eweibel.net\/?p=1154","url_meta":{"origin":622,"position":3},"title":"TF.exe or maybe the most useful tool for TFS","author":"Patrick","date":"31. Jan 2012","format":false,"excerpt":"When you've to use TFS, then there are moments when you're missing some features in the UI tools in Visual Studio. In those situations the console tool tf.exe is very useful. In this short blog post I summarized the commands I used the most. Update an old version of a\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/blog.eweibel.net\/?cat=13"},"img":{"alt_text":"visualstudio","src":"https:\/\/i0.wp.com\/blog.eweibel.net\/wp-content\/uploads\/visualstudio_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":954,"url":"https:\/\/blog.eweibel.net\/?p=954","url_meta":{"origin":622,"position":4},"title":"Visualize changes in your repository","author":"Patrick","date":"17. Feb 2011","format":false,"excerpt":"As you perhaps know, there exists a very interesting project on Google code, with which you can visualize the activities on your repository: Gource. Getting started It supports Git, Mercurial, Bazaar and SVN. There is also a way to visualize the changes in a repository of a Microsoft Team Foundation\u2026","rel":"","context":"In &quot;New technology&quot;","block_context":{"text":"New technology","link":"https:\/\/blog.eweibel.net\/?cat=6"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":718,"url":"https:\/\/blog.eweibel.net\/?p=718","url_meta":{"origin":622,"position":5},"title":"Do frameworks kill design skills?","author":"Patrick","date":"8. Feb 2011","format":false,"excerpt":"Software design is one of the most important skills a software engineer should have. But what is software design exactly? If you search for a definition you find something like this: Software design is a process of problem-solving and planning for a software solution. After the purpose and specifications of\u2026","rel":"","context":"In &quot;Design patterns&quot;","block_context":{"text":"Design patterns","link":"https:\/\/blog.eweibel.net\/?cat=3"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/blog.eweibel.net\/wp-content\/uploads\/image_thumb11.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts\/622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=622"}],"version-history":[{"count":22,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts\/622\/revisions"}],"predecessor-version":[{"id":729,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts\/622\/revisions\/729"}],"wp:attachment":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}