{"id":1278,"date":"2016-06-15T21:23:23","date_gmt":"2020-02-18T06:55:22","guid":{"rendered":"https:\/\/redfrontdoor.org\/blg2\/?p=1278"},"modified":"2020-02-18T16:51:25","modified_gmt":"2020-02-18T16:51:25","slug":"post-1272","status":"publish","type":"post","link":"https:\/\/redfrontdoor.org\/blog\/?p=1278","title":{"rendered":"git-dendrify &mdash; a tool for transforming git histories"},"content":{"rendered":"<p>I&#8217;ve been working with <code>git<\/code> for a while now, and have been experimenting with it as a way to present the history of a piece of code in a way which makes it easier for a human reader to understand.  One way I think <code>git<\/code> can help with this is by adding structure to the collection of commits.  Rather than just a simple flat list of commits, you can use branches and merges to give a hierarchical structure to the presentation.  However, re-drafting your (local) history in the presence of merges is troublesome, so I wrote <a href=\"https:\/\/github.com\/bennorth\/git-dendrify\"><code>git-dendrify<\/code><\/a> to help.  It transforms your history between a linear form and a structured form.<\/p>\n<p>For example, suppose we&#8217;re adding printing to a word processor.  A flat list of commits to do this might be as follows, with the most recent at the top:<\/p>\n<pre>\n* Allow choice of colour for printing watermarks\n* Add known-good test cases for watermarks\n* Emit watermark 'underneath' main output (printing)\n* Drop-down for printing common watermarks\n* Submit PDF to system print service\n* Add known-good PDF-generation test cases\n* Generate PDF\n* Sort paper size choices alphabetically\n* Read paper size choices from database\n* Add selection box for paper sizes\n* Read printer list from system\n* Add selection box for which printer\n* Parse 'chosen pages' input like '5-8,11,12-15'\n* Allow free-form CSV list of pages\n* Radio list for 'pages' UI: current, all, chosen\n:\n: <em>( older history )<\/em>\n<\/pre>\n<p>A hierarchical, or tree-like, structure shows the development more clearly:<\/p>\n<pre>\n* Add printing facility\n|\\\n| * Add watermarks\n| |\\\n| | * Allow choice of colour\n| | * Add known-good test cases\n| | * Emit watermark 'underneath' main output\n| | * Drop-down for common watermarks\n| |\/\n| * Add actual printing via PDF\n| |\\\n| | * Submit PDF to system print service\n| | * Add known-good test cases\n| | * Generate PDF\n| |\/\n| * Add paper selection UI\n| |\\\n| | * Sort choices alphabetically\n| | * Read paper size choices from database\n| | * Add selection box for paper sizes\n| |\/\n| * Add printer selection UI\n| |\\\n| | * Read printer list from system\n| | * Add selection box for which printer\n| |\/\n| * Add page selection UI\n| |\\\n| | * Parse input like '5-8,11,12-15'\n| | * Allow free-form CSV list of pages\n| | * Radio list: current, all, chosen\n| |\/\n| |\n|\/\n:\n: <em>( older history )<\/em>\n<\/pre>\n<p>The workflow would be to re-order, squash, re-word, split, etc., the history in its linear form, and then turn it into the tree-like structure (&#8216;dendrify&#8217; it) for presentation to others.<\/p>\n<p><a href=\"https:\/\/github.com\/bennorth\/git-dendrify\">The github repository<\/a> has a README with more details; it also explores some related questions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been working with git for a while now, and have been experimenting with it as a way to present the history of a piece of code in a way which makes it easier for a human reader to understand. One way I think git can help with this is by adding structure to the collection of commits. Rather than just a simple flat list of commits, you can use branches and merges to give a hierarchical structure to the presentation. However, re-drafting your (local) history in the presence of merges is troublesome, so I wrote git-dendrify to help. It transforms your history between a linear form and a structured form. For example, suppose we&#8217;re adding printing to a word<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1278","post","type-post","status-publish","format-standard","hentry","category-uncategorized","comments-off"],"_links":{"self":[{"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1278"}],"version-history":[{"count":1,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1278\/revisions"}],"predecessor-version":[{"id":2156,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1278\/revisions\/2156"}],"wp:attachment":[{"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}