{"id":2705,"date":"2018-02-01T18:13:59","date_gmt":"2018-02-02T00:13:59","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/?p=2705"},"modified":"2018-02-01T18:13:59","modified_gmt":"2018-02-02T00:13:59","slug":"feature-branch-development","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/2705","title":{"rendered":"Feature branch development"},"content":{"rendered":"<p>I remember when I had lunch with a friend, back when I was using SVN and he was using git.\u00a0 He said &#8220;it&#8217;ll change your life&#8221;.\u00a0 I had read about <a href=\"http:\/\/darcs.net\/\">darcs<\/a> years ago and had read <a href=\"https:\/\/www.joelonsoftware.com\/2010\/03\/17\/distributed-version-control-is-here-to-stay-baby\/\">Joel&#8217;s post about distributed version control systems<\/a>.\u00a0 I was still like &#8220;meh.\u00a0 SVN does what I need it to do&#8211;tag releases, keep track of changes, and I can branch if I need to&#8221;.<\/p>\n<p>Boy, was I wrong.<\/p>\n<p>I&#8217;ve been using git since around 2014, and it&#8217;s great.\u00a0 I don&#8217;t remember where I heard it, but someone said &#8220;branching in SVN is easy, it&#8217;s the merging that is difficult&#8221;.\u00a0 Git takes the pain out of merging (mostly, of course you can still hose yourself pretty well).\u00a0 I have to also reference this <a href=\"https:\/\/xkcd.com\/1597\/\">classic XKCD comic<\/a> whenever I talk about git.<\/p>\n<p>Regardless, one of the things I&#8217;m loving about working with git is that if you always use feature branches, use story numbers in your branch name (like <code>story-update-123<\/code>), and you set up your <code>prepare-commit-msg<\/code> script, you can track back every change to a story.\u00a0 Here&#8217;s my <code>prepare-commit-msg<\/code> script:<\/p>\n<pre>\r\n#!\/bin\/sh\r\n\r\n# from http:\/\/stackoverflow.com\/a\/16061192\/203619\r\n\r\nif story_id=`git branch |grep '*'|sed 's\/.*-\/\/'`\r\nthen\r\n    echo \"[#$story_id]\" >> \"$1\"\r\nfi\r\n<\/pre>\n<p>Another nice feature of the branch handling is that you can roll forward and backward branches.  I use bitbucket, so I use the GUI revert command, which creates a nice revert PR.  (I then immediately revert the revert PR so that I can apply the intended changes in the future by merging the second PR.)  This makes it possible to push a feature to staging, realize it isn&#8217;t fully baked, and revert it so you can get out another feature release.  Perhaps you could do this with SVN or another centralized VCS, but I was never comfortable enough with branches to do it.<\/p>\n<p>All in all, git has been life changing as a developer.  Thanks Russ, you were right!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I remember when I had lunch with a friend, back when I was using SVN and he was using git.\u00a0 He said &#8220;it&#8217;ll change your life&#8221;.\u00a0 I had read about [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,33],"tags":[],"class_list":["post-2705","post","type-post","status-publish","format-standard","hentry","category-programming","category-useful-tools"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2705"}],"version-history":[{"count":3,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2705\/revisions"}],"predecessor-version":[{"id":2708,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2705\/revisions\/2708"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}