<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>github Archives &#8211; Structured Procrastination</title>
	<atom:link href="https://blog.adamspiers.org/tag/github/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.adamspiers.org/tag/github/</link>
	<description>because there&#039;s always something more interesting than what you should be doing</description>
	<lastBuildDate>Wed, 01 Jun 2022 14:31:53 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>

<image>
	<url>https://blog.adamspiers.org/wp-content/uploads/2018/12/cropped-IMG_20160907_193859-PANO-c-7-32x32.jpg</url>
	<title>github Archives &#8211; Structured Procrastination</title>
	<link>https://blog.adamspiers.org/tag/github/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Squash-merging and other problems with GitHub</title>
		<link>https://blog.adamspiers.org/2017/08/16/squash-merging-and-other-problems-with-github/</link>
					<comments>https://blog.adamspiers.org/2017/08/16/squash-merging-and-other-problems-with-github/#comments</comments>
		
		<dc:creator><![CDATA[Adam]]></dc:creator>
		<pubDate>Wed, 16 Aug 2017 17:45:00 +0000</pubDate>
				<category><![CDATA[front page]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[hacking]]></category>
		<guid isPermaLink="false">http://blog.adamspiers.org/?p=1534</guid>

					<description><![CDATA[<p>(Thanks to Ben North, Colleen Murphy, and Nicolas Bock for reviewing earlier drafts of this post.) In April 2016, GitHub announced a new feature supporting squashing of multiple commits in a PR at merge-time (announced on April 1st, but it was actually bona-fide 😉 ). I appreciate that there was high demand for this feature [&#8230;]</p>
<p>The post <a href="https://blog.adamspiers.org/2017/08/16/squash-merging-and-other-problems-with-github/">Squash-merging and other problems with GitHub</a> appeared first on <a href="https://blog.adamspiers.org">Structured Procrastination</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p> (Thanks to <a href="http://redfrontdoor.org/blog/">Ben North</a>, <a href="http://www.gazlene.net/">Colleen Murphy</a>, and <a href="https://nicolasbock.github.io/">Nicolas Bock</a> for reviewing earlier drafts of this post.) </p>
<p> In April 2016, <a href="https://github.com/blog/2141-squash-your-commits">GitHub announced a new feature supporting squashing of multiple commits in a PR at merge-time</a> (announced on April 1st, but it was actually bona-fide <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> ). </p>
<p> I appreciate that there was high demand for <a href="https://github.com/isaacs/github/issues/406">this feature</a> (and <a href="https://gitlab.com/gitlab-org/gitlab-ce/issues/4106">similarly</a> <a href="https://gitlab.com/gitlab-org/gitlab-ce/issues/34591">on</a> <a href="https://gitlab.uservoice.com/forums/176466-deprecated-feedback-forum/suggestions/5662794-provide-squash-option-when-merging-merge-requests">GitLab</a>), and apparently that <a href="https://softwareengineering.stackexchange.com/questions/263164/why-squash-git-commits-for-pull-requests">many projects have a &#8220;squash before submitting a PR&#8221; policy</a>, but I&#8217;d like to contend that this is a poor-man&#8217;s workaround for the lack of a real solution to the underlying problems. </p>
<div id="outline-container-orgf03e50a" class="outline-2">
<h2 id="why"><a id="orgf03e50a" name="orgf03e50a"></a>Why squash-merge?</h2>
<div class="outline-text-2" id="text-why">
<p> So what are the underlying problems which made this such a frequently requested feature?  From reading the various links above, it seems that by far the biggest motivator is that people frequently submit pull requests (or merge requests, in GitLab-speak) which contain multiple commits, and these commits are seen as too &#8220;noisy&#8221; / fine-grained.  In other words there is a desire to not pollute the target/trunk branch (e.g. <code>master</code>) with these fine-grained commits, and instead only have larger, less fine-grained commits merged. </p>
<p> But where does this desire come from?  Well, if the fine-grained commits which accumulate on a PR branch are frequently amendments to earlier commits in the same PR (like &#8220;oops, fix typo I just made&#8221; or &#8220;oops, fix bug I just introduced&#8221;) then this desire is entirely understandable, because noone wants to see that kind of mess on <code>master</code>.  However the real problem here is that that kind of mess should have never made it onto GitHub in the first place &#8211; not even onto a PR branch!  It should have instead been fixed in the developer&#8217;s local repository.  That is why there is <a href="https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History">a whole section in the &#8220;Pro Git&#8221; book dedicated to explaining how to rewrite local history</a>, and why <a href="https://git-scm.com/docs/git-commit"><code>git-commit(1)</code></a> and <a href="https://git-scm.com/docs/git-rebase"><code>git-rebase(1)</code></a> have native support for creating and squashing &#8220;fixup&#8221; commits into commits which they fix. </p>
</div>
</div>
<div id="outline-container-orgb78c08e" class="outline-2">
<h2 id="use-the-force"><a id="orgb78c08e" name="orgb78c08e"></a>Use the force-push, Luke</h2>
<div class="outline-text-2" id="text-use-the-force">
<p> If an existing PR needs to be amended, make the change and then rewrite local history so that it&#8217;s clean.  The new version of the branch can then be force-pushed to GitHub via <code>git push -f</code>, which is an operation GitHub understands and in many situations handles reasonably gracefully.  <a href="http://blog.adamspiers.org/why-and-how-to-correctly-amend-github-pull-requests/">I have previously blogged about why this way is better</a>, but one way of quickly summarising it is: <b>don&#8217;t wash your dirty linen in public any more than you have to</b>. </p>
<p><span id="more-1534"></span></p>
<p> In other words, <b>if you do your history rewriting locally, there will be a substantial increase in the quality of what you publish to the PR</b>, because you will only ever publish commits which (at the time) you believed to be the final candidate, ready for merging. (And later, when you benefit from the hindsight of peer reviews and/or your own realisations about how to make things better, you simply force-push a new final candidate.) Consequently, people reviewing your PR don&#8217;t have to waste time reviewing anything unless it was a candidate for merging, and nor do CI systems. </p>
<p> Granted, there are some exceptions to this approach, where you really do want to publish a PR which is still work in progress in order to get early feedback.  In that case you can explicitly state in the PR description (or via a <a href="https://help.github.com/articles/creating-and-editing-labels-for-issues-and-pull-requests/">label</a>) that this PR is WIP so that anyone reviewing it will know to expect some mess, and that&#8217;s totally fine. </p>
</div>
</div>
<div id="outline-container-orge131a8c" class="outline-2">
<h2 id="force-push-problems"><a id="orge131a8c" name="orge131a8c"></a>The force-push is not so strong with this one</h2>
<div class="outline-text-2" id="text-force-push-problems">
<p> Unfortunately, the force-push approach is not perfect either: the full history (a.k.a. <a href="https://git-scm.com/docs/git-reflog"><code>reflog</code></a>) of the PR branch is <a href="https://github.com/isaacs/github/issues/999">not exposed via GitHub&#8217;s UI</a>, <a href="https://github.com/isaacs/github/issues/997">nor are there even guarantees that it will be preserved</a>.  This is one of GitHub&#8217;s serious flaws, which in contrast <a href="https://www.mediawiki.org/wiki/Gerrit/Tutorial#Comparing_patch_sets">Gerrit gets right</a>, and services integrating with GitHub such as <a href="https://reviewable.io/">https://reviewable.io/</a> and <a href="http://gerrithub.io/">http://gerrithub.io/</a> can also help fill in the gaps here.  The poor man&#8217;s workaround is to manually add comments every time you force-push, which explain what changed and how the changes address feedback from reviewers, but this of course requires discipline and extra effort, and does not show the exact changes, so it&#8217;s far from ideal. </p>
</div>
</div>
<div id="outline-container-orged0b022" class="outline-2">
<h2 id="other-problems"><a id="orged0b022" name="orged0b022"></a>I&#8217;ve got a bad feeling about this</h2>
<div class="outline-text-2" id="text-other-problems">
<p> These drawbacks with GitHub are another reason that some people prefer to append fixup commits to the PR and then squash at merge-time &#8211; at least then the history of the PR is visible to all.  But this approach only works with PRs which represent a single logical change.  <a href="https://wiki.openstack.org/wiki/GitCommitMessages#Structural_split_of_changes">If you squash multiple logical changes into a single commit, you lose valuable history.</a>  (In fact, this value can extend as far as <a href="https://github.com/bennorth/git-dendrify/blob/master/README.md">using the history for literate programming</a>.)  So I strongly recommend keeping the GitHub repo configured with the default setting which allows normal merges, so that you don&#8217;t force this history loss on merge of PRs. </p>
<p> In response to the previous issue, you could decide a policy where you insist on clean commits and normal merging if the PR contains multiple logical changes, but allow unclean commits and squash merging if the PR contains only a single logical change.  However the decision whether to do squash merge or normal merge is left to the merger, and it&#8217;s made at merge-time, outside the peer review process.  So on a bigger project where many people have merge permissions, that reduces the chance of merges being done in a correct and consistent way. </p>
<p> By the way, <a href="https://julien.danjou.info/blog/2013/rant-about-github-pull-request-workflow-implementation">I&#8217;m not the first person who has highlighted these problems</a>. </p>
</div>
</div>
<div id="outline-container-orgedc8f76" class="outline-2">
<h2 id="no-dependencies"><a id="orgedc8f76" name="orgedc8f76"></a>I find your lack of dependencies disturbing</h2>
<div class="outline-text-2" id="text-no-dependencies">
<p> OK sorry, that&#8217;s enough Star Wars quotes. </p>
<p> But this awkwardness highlights another fundamental issue with GitHub: it does not <i>conveniently</i> support &#8220;stacking&#8221; one PR on top of another, i.e. where the head of the first is the base of the second, with a dependency modelled between the two.  (You <i>can</i> do it, but it&#8217;s awkward when the PRs come from different <a href="https://help.github.com/articles/fork-a-repo/">forks</a>, and you also have to <a href="https://github.com/blog/2224-change-the-base-branch-of-a-pull-request">change the base branch</a> of the second once the first is merged.) </p>
<p> So the only convenient way to group two dependent commits together is to put them in the same PR.  This encourages the creation of PRs with many commits, which suck up more and more review effort each time their history is rewritten, and take longer to merge on average, because controversial and non-controversial commits tend to get mixed up within the same PR, and the former block the latter. </p>
<p> This is another area where Gerrit beats GitHub, since <a href="https://www.mediawiki.org/wiki/Gerrit/Advanced_usage#Create_a_dependency">Gerrit natively supports dependencies between reviews</a>, making the need for multiple commits per review redundant.  Another advantage of this is that you don&#8217;t have to write a separate description for the PR, since all the info the reviewer requires is provided in a single commit message. </p>
<p> Anyway, I digress; back to squash merging.  Another issue with it is that the final editing of the squashed commit message is <b>after</b> the review process, not during.  If, like me, you work on <a href="https://wiki.openstack.org/wiki/GitCommitMessages#Information_in_commit_messages">projects which care deeply about the quality of the commit message</a>, this is a deal-breaker. </p>
<p> Finally, the GitHub web UI doesn&#8217;t show when squash merging has been used, which can create confusion. </p>
</div>
</div>
<div id="outline-container-org7647710" class="outline-2">
<h2 id="summary"><a id="org7647710" name="org7647710"></a>Summary</h2>
<div class="outline-text-2" id="text-summary">
<p> To wrap up, there is no perfect solution right now.  However the following guidelines should help: </p>
<ul class="org-ul">
<li>Always adhere to <a href="https://wiki.openstack.org/wiki/GitCommitMessages">best practice for constructing git commits</a>.</li>
<li>Try to keep your mess to yourself as much as possible, by rewriting history locally before publishing to or updating a GitHub PR.</li>
<li>Squash merging will <b>not</b> work well for projects with stricter review policies, or projects which receive PRs comprising of multiple logical changes.</li>
<li>Squash merging <i>might</i> work OK as a workaround for smaller projects with less stringent review policies, where PRs only ever consist of a single logical change which can reasonably be squashed into a single commit without harm.</li>
<li>Keep PRs as small as possible, and aim for quick, short review cycles.</li>
</ul>
<p> And in case the right people are listening: </p>
<ul class="org-ul">
<li>GitHub needs to <a href="https://github.com/isaacs/github/issues/997">track PR history</a> and <a href="https://github.com/isaacs/github/issues/998">expose it</a> through <a href="https://github.com/isaacs/github/issues/999">the UI</a>.</li>
<li><a href="https://github.com/isaacs/github/issues/959">GitHub needs to support stacking of PRs</a> (i.e. tracking dependencies between PRs, and correctly handling when a dependency gets merged).</li>
</ul>
</div>
</div>
<p><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fblog.adamspiers.org%2F2017%2F08%2F16%2Fsquash-merging-and-other-problems-with-github%2F&#038;title=Squash-merging%20and%20other%20problems%20with%20GitHub" data-a2a-url="https://blog.adamspiers.org/2017/08/16/squash-merging-and-other-problems-with-github/" data-a2a-title="Squash-merging and other problems with GitHub"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://blog.adamspiers.org/2017/08/16/squash-merging-and-other-problems-with-github/">Squash-merging and other problems with GitHub</a> appeared first on <a href="https://blog.adamspiers.org">Structured Procrastination</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.adamspiers.org/2017/08/16/squash-merging-and-other-problems-with-github/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Why and how to correctly amend GitHub pull requests</title>
		<link>https://blog.adamspiers.org/2015/03/24/why-and-how-to-correctly-amend-github-pull-requests/</link>
					<comments>https://blog.adamspiers.org/2015/03/24/why-and-how-to-correctly-amend-github-pull-requests/#comments</comments>
		
		<dc:creator><![CDATA[Adam]]></dc:creator>
		<pubDate>Tue, 24 Mar 2015 14:00:00 +0000</pubDate>
				<category><![CDATA[front page]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[hacking]]></category>
		<guid isPermaLink="false">http://blog.adamspiers.org/?p=1465</guid>

					<description><![CDATA[<p>Like many F/OSS developers, I&#8217;m a heavy user of GitHub, collaborating on many projects which use the typical &#8220;fork &#38; pull&#8221; workflow based on pull requests. The GitHub documentation on pull requests covers this workflow fairly comprehensively, but there seems to be one area which is significantly lacking in detail: why and how to amend [&#8230;]</p>
<p>The post <a href="https://blog.adamspiers.org/2015/03/24/why-and-how-to-correctly-amend-github-pull-requests/">Why and how to correctly amend GitHub pull requests</a> appeared first on <a href="https://blog.adamspiers.org">Structured Procrastination</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p> Like many <a href="http://en.wikipedia.org/wiki/Free_and_open-source_software">F/OSS</a> developers, I&#8217;m a <a href="https://github.com/aspiers">heavy user</a> of <a href="https://github.com/">GitHub</a>, collaborating on many projects which use the typical &#8220;fork &amp; pull&#8221; workflow based on <a href="https://help.github.com/articles/using-pull-requests/">pull requests</a>.  The <i>GitHub documentation on pull requests</i> covers this workflow fairly comprehensively, but there seems to be one area which is significantly lacking in detail: why and how to <b>amend</b> <b>existing</b> pull requests.  The article simply says: </p>
<blockquote><p>
After your pull request is sent, any new commits pushed to your branch will automatically be added to the pull request. This is especially useful if you need to make more changes.
</p></blockquote>
<p> The problem is that this completely ignores the fact that there are often very good reasons for <b>amending</b> existing commits within the pull request, not just for <b>adding</b> new commits it. </p>
<div id="outline-container-sec-1" class="outline-2">
<h2 id="sec-1">Why amend an existing pull request?</h2>
<div class="outline-text-2" id="text-1">
<p> A peer review cycle can potentially reveal many issues which make the pull request unready for merging, e.g. </p>
<ul class="org-ul">
<li>typos
</li>
<li>bugs in the proposed code changes
</li>
<li>missing features in the proposed code changes
</li>
<li>incomplete test coverage
</li>
<li>incomplete documentation changes
</li>
<li>style inconsistencies (including whitespace issues)
</li>
<li>incorrect or incomplete commit messages
</li>
<li>the commits violate the rule of <a href="https://wiki.openstack.org/wiki/GitCommitMessages#Structural_split_of_changes">one logical change per commit</a>
</li>
<li>some changes are outside the scope of the pull request
</li>
</ul>
<p> This is of course what makes peer review of pull requests so valuable: the problems can be addressed even before they hit the <code>master</code> branch, which helps maintain high quality in the development trunk.  But then <b>how</b> do we address the issues? </p>
<p><span id="more-1465"></span>
</div>
</div>
<div id="outline-container-sec-2" class="outline-2">
<h2 id="sec-2">How <b>not</b> to amend your existing pull requests</h2>
<div class="outline-text-2" id="text-2">
<p> One approach is for the submitter fix the issues in their original local branch, close the pull request, and submit a new one. However in most cases this is a bad idea, because each time you do it, you create an &#8220;orphaned&#8221; abandoned pull request, and there is no automatic linking between the new revised one and the abandoned one, which makes it a lot harder to follow the history of the review process. </p>
<p> Another approach (the one apparently implied by the GitHub documentation mentioned above) is to append &#8220;fixup&#8221; commits to the series which fix issues introduced by commits earlier in the series.  But that&#8217;s almost always a really bad idea, because again it violates the rule of <a href="https://wiki.openstack.org/wiki/GitCommitMessages#Structural_split_of_changes">one logical change per commit</a>.  In particular: </p>
<ul class="org-ul">
<li>
<p> It makes life much harder for reviewers, because they have to review a combination of broken commits and subsequent commits which are supposed to fix that brokenness.  So for each change, they have follow this process: </p>
<ol class="org-ol">
<li>Review it as normal.
</li>
<li>If they spot brokenness, refrain from immediately commenting on it, and instead look ahead for any subsequent commit in the series which may claim to fix that brokenness.
</li>
<li>If such a commit is found, verify that it really does fix the brokenness.
</li>
<li>If it does fix it, selectively ignore that brokenness, whilst taking care not to accidentally ignore other brokenness in the same area.
</li>
</ol>
<p> This problem is significantly compounded each review cycle, i.e. each time fixup commits are appended to the pull request. </p>
<p> The only workaround is to review via the &#8220;Files changed&#8221; tab, but that brings considerable disadvantages when the pull request contains more than one commit, because then the reviewer cannot review individual logical changes one at a time. </p>
</li>
<li>After merging the pull request, it pollutes the project&#8217;s history with useless noise: fixup commits which are not linked to the commits they are fixing.
</li>
<li>It breaks <code>git bisect</code>, <code>git revert</code>, and <code>git blame</code>.
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-3" class="outline-2">
<h2 id="sec-3">The <b>right</b> way to amend your existing pull requests</h2>
<div class="outline-text-2" id="text-3">
<p> The good news is that GitHub actually supports a much better alternative which works really nicely.  As a maintainer and reviewer of many GitHub repositories, I&#8217;ve been continually surprised how many people are unaware of this simple trick; perhaps it&#8217;s due to the hole in GitHub&#8217;s pull request documentation which I mentioned above?  The trick is simply this: </p>
<ol class="org-ol">
<li>Rewrite the history of your local branch corresponding to the pull request, so that the issues revealed during the review of the pull request are addressed.
</li>
<li>Do a <b>force push</b> (i.e. a <code>git push</code> command which includes the <code>--force-with-lease</code> option, <em>not</em> <code>-f</code> / <code>--force</code> which is dangerous and should never be used).
</li>
</ol>
<p> I won&#8217;t go into details here about how to rewrite history.  <code>git</code> history rewriting via <code>git rebase</code> (with <code>fixup</code>, <code>squash</code>), <code>git commit --amend</code> etc. is something of an art form, and there are already <a href="https://www.google.com/#q=git+rewrite+history">many great resources</a> out there which there would be no value in me replicating. </p>
<p> So really this whole blog post is a long way of saying: </p>
<blockquote><p>
<b>When you force-push a new head for a pull request branch, GitHub handles it gracefully and automatically updates</b> <b>the pull request in the way you want.</b>
</p></blockquote>
<p> It&#8217;s almost like magic.  For example, if a reviewer commented on two hunks in the original pull request, and your force-push effectively rewrites one of those hunks but not the other, then the GitHub pull request UI will get updated to say something like &#8220;@reviewer commented on an outdated diff&#8221; for the rewritten hunk, but any outstanding review comments on the changed hunk will be presented as before the force-push. </p>
<p> Now don&#8217;t get me wrong &#8211; GitHub is not perfect.  In some (but not all) ways, it is inferior to <a href="https://code.google.com/p/gerrit/">Gerrit&#8217;s review system</a> which is better at exposing the complete history of the review cycle.  I previously wrote <a href="http://blog.adamspiers.org/2013/05/12/in-partial-defense-of-githubs-review-system/">another blog post examining GitHub&#8217;s review system in more depth</a>.  But in general, it&#8217;s usually plenty good enough. </p>
</div>
</div>
<div id="outline-container-sec-4" class="outline-2">
<h2 id="sec-4">A footnote about git&#8217;s force-push</h2>
<div class="outline-text-2" id="text-4">
<p> If you&#8217;ve previously been fed the mantra &#8220;git force-push is evil, don&#8217;t ever use it&#8221;, or the more specific version &#8220;don&#8217;t ever force-push to public branches&#8221; then hopefully you now realise neither are correct.  There are many perfectly valid use cases for force push, otherwise the extremely clever developers who implemented it wouldn&#8217;t have bothered (and let&#8217;s face it, they know far more about <code>git</code> than you or I ever will).  Ultimately the validity / safety of doing a force push to a public branch depends on the audience&#8217;s expectations for the stability of that branch.  If people expect it to be stable and never get rewritten (only fast-forwarded), then you shouldn&#8217;t force push, or at least not without a decent effort to correct those people&#8217;s expectations.  However there is generally no reason why people should expect GitHub pull request branches to be stable, because people generally don&#8217;t base other branches on top of them. </p>
<p> The article entitled <a href="http://willi.am/blog/2014/08/12/the-dark-side-of-the-force-push/">&#8220;The Dark Side of the Force Push&#8221;</a> may help further your understanding. </p>
</div>
</div>
<div id="outline-container-sec-5" class="outline-2">
<h2 id="sec-5">Taking over amendment of someone else&#8217;s pull requests</h2>
<div class="outline-text-2" id="text-5">
<p> Note that the title of the previous sections referred to <b>your</b> existing pull requests.  GitHub doesn&#8217;t let you amend anyone <b>else&#8217;s</b> pull requests, and that&#8217;s a good thing for obvious reasons.  But what if one developer submits a pull request, vanishes off on holiday, and whilst they are away, it gets reviewed and issues are revealed? </p>
<p> In this case it&#8217;s easy to effectively take over the process.  Simply create a local branch which points to the same commit as the head of the pull request.  If you have the totally awesome <a href="https://hub.github.com/"><code>hub</code> CLI tool</a> installed, then this is as simple as: </p>
<pre class="brush: bash; light: true; title: ; notranslate">
git checkout https://github.com/github/hub/pull/134
</pre>
<p> Then amend your branch as necessary according to the existing reviews, and submit a new pull request which references the old pull request it&#8217;s superceding, either by URL or by number.  You will probably also want to arrange for the old pull request to be closed with a comment linking to its successor. </p>
</div>
</div>
<p><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fblog.adamspiers.org%2F2015%2F03%2F24%2Fwhy-and-how-to-correctly-amend-github-pull-requests%2F&#038;title=Why%20and%20how%20to%20correctly%20amend%20GitHub%20pull%20requests" data-a2a-url="https://blog.adamspiers.org/2015/03/24/why-and-how-to-correctly-amend-github-pull-requests/" data-a2a-title="Why and how to correctly amend GitHub pull requests"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://blog.adamspiers.org/2015/03/24/why-and-how-to-correctly-amend-github-pull-requests/">Why and how to correctly amend GitHub pull requests</a> appeared first on <a href="https://blog.adamspiers.org">Structured Procrastination</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.adamspiers.org/2015/03/24/why-and-how-to-correctly-amend-github-pull-requests/feed/</wfw:commentRss>
			<slash:comments>13</slash:comments>
		
		
			</item>
		<item>
		<title>managing your github notifications inbox with mutt</title>
		<link>https://blog.adamspiers.org/2014/10/05/managing-your-github-notifications-inbox-with-mutt/</link>
					<comments>https://blog.adamspiers.org/2014/10/05/managing-your-github-notifications-inbox-with-mutt/#comments</comments>
		
		<dc:creator><![CDATA[Adam]]></dc:creator>
		<pubDate>Sun, 05 Oct 2014 12:59:00 +0000</pubDate>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[inbox]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[mutt]]></category>
		<category><![CDATA[notifications]]></category>
		<guid isPermaLink="false">http://blog.adamspiers.org/?p=1122</guid>

					<description><![CDATA[<p>Like many F/OSS developers, I&#8217;m a heavy user of GitHub. This means I interact with other developers via GitHub multiple times a day. GitHub has a very nice notifications system which lets me know when there has been some activity on a project I&#8217;m collaborating on. I&#8217;m a fan of David Allen&#8217;s GTD (&#8220;Getting Things [&#8230;]</p>
<p>The post <a href="https://blog.adamspiers.org/2014/10/05/managing-your-github-notifications-inbox-with-mutt/">managing your github notifications inbox with mutt</a> appeared first on <a href="https://blog.adamspiers.org">Structured Procrastination</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p> Like many <a href="http://en.wikipedia.org/wiki/Free_and_open-source_software">F/OSS</a> developers, I&#8217;m a <a href="https://github.com/aspiers">heavy user</a> of <a href="https://github.com/">GitHub</a>.  This means I interact with other developers via GitHub multiple times a day. GitHub has a very nice <a href="https://help.github.com/articles/about-notifications/">notifications system</a> which lets me know when there has been some activity on a project I&#8217;m collaborating on. </p>
<p> I&#8217;m a fan of David Allen&#8217;s <a href="http://gettingthingsdone.com/">GTD (&#8220;Getting Things Done&#8221;) system</a>, and in my experience I get the best results by minimising the number of inboxes I have to look at every day.  So I use another great feature of GitHub, which is the ability to have <a href="https://help.github.com/articles/configuring-notification-emails/">notification emails delivered directly to your email inbox</a>.  This means I don&#8217;t have to keep checking <a href="https://github.com/notifications">https://github.com/notifications</a> in addition to my email inbox. </p>
<p> However, this means that I receive GitHub notifications in two places. Wouldn&#8217;t it be nice if when I read them in my email inbox, GitHub could somehow realise and mark them read at <a href="https://github.com/notifications">https://github.com/notifications</a> too, so that when I look there, I don&#8217;t end up getting reminded about notifications I&#8217;ve already seen in my inbox?  Happily the folks at GitHub already thought of this too, and come up with a solution: </p>
<blockquote>
<p> If you read a notification email, it&#8217;ll automatically be marked as read in the Notifications section. An invisible image is embedded in each mail message to enable this, which means that you must allow viewing images from notifications@github.com in order for this feature to work. </p>
<p> &#x2013; <a href="https://help.github.com/articles/configuring-notification-emails/#shared-read-state">https://help.github.com/articles/configuring-notification-emails/#shared-read-state</a> </p>
</blockquote>
<p> But there&#8217;s a catch!  Like many Linux geeks, I use <a href="http://www.mutt.org/">mutt</a> for reading and writing email.  In fact, I&#8217;ve been using it since 1997 and I&#8217;m still waiting for another <a href="http://en.wikipedia.org/wiki/Email_client">MUA</a> to appear which is more powerful and lets me crunch through email faster.  However mutt is primarily text-based, which means by default it doesn&#8217;t download images when displaying HTML-based email.  Of course, it <b>can</b>.  But do I want it to automatically open a new tab in my browser every time I encounter an HTML attachment?  No!  That would slow me down horribly.  Even launching a terminal-based HTML viewer such as <a href="http://w3m.sourceforge.net/">w3m</a> or <a href="http://links.twibright.com/">links</a> or <a href="http://lynx.browser.org/">lynx</a> would be too slow. </p>
<p> So I figured out a better solution.  mutt has a <a href="http://www.mutt.org/doc/manual/manual-3.html#message-hook">nice <code>message-hook</code> feature</a> where you can configure it to automatically execute mutt functions for any message matching specific criteria just before it displays the message.  So we can use that to pipe the whole email to a script whenever a message is being read for the first time: </p>
<pre class="brush: bash; light: true; title: ; notranslate">
message-hook &quot;(~N|~O) ~f notifications@github.com&quot; &quot;push &#039;&lt;pipe-message&gt;read-github-notification\n&#039;&quot;
</pre>
<p> <code>(~N|~O)</code> matches mails which have the <code>N</code> flag (meaning new unread email) or <code>O</code> (meaning old unread email) set. </p>
<p> The <a href="https://github.com/aspiers/mutt.pub/blob/master/bin/read-github-notification"><code>read-github-notifications</code> script</a> reads the email on <code>STDIN</code>, extracts the URL of the 1-pixel read notification beacon &lt;img&gt; embedded in the HTML attachment, and sends an HTTP request for that image, so that github knows the notification has been read. </p>
<p> This means an extra delay of 0.5 seconds or so when viewing a notification email, but for me it&#8217;s a worthwhile sacrifice. </p>
<p> If you want to try it, simply <a href="https://raw.githubusercontent.com/aspiers/mutt.pub/master/bin/read-github-notification">download the script</a> and stick it somewhere on your <code>$PATH</code>, and then add the above line to your <code>~/.muttrc</code> file. </p>
<p> <b>UPDATE 2017/08/29:</b> Unfortunately I have since discovered that <a href="https://superuser.com/questions/1224053/configuring-mutt-to-pipe-a-mail-to-a-command-when-viewing-for-the-first-time">the above solution breaks when you try to save one of these notifications before reading it</a>.  Suggestions on how to fix this are most welcome! </p>
<p><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fblog.adamspiers.org%2F2014%2F10%2F05%2Fmanaging-your-github-notifications-inbox-with-mutt%2F&#038;title=managing%20your%20github%20notifications%20inbox%20with%20mutt" data-a2a-url="https://blog.adamspiers.org/2014/10/05/managing-your-github-notifications-inbox-with-mutt/" data-a2a-title="managing your github notifications inbox with mutt"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://blog.adamspiers.org/2014/10/05/managing-your-github-notifications-inbox-with-mutt/">managing your github notifications inbox with mutt</a> appeared first on <a href="https://blog.adamspiers.org">Structured Procrastination</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.adamspiers.org/2014/10/05/managing-your-github-notifications-inbox-with-mutt/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
