tag:blogger.com,1999:blog-75239187269723169532024-03-28T01:15:24.170-07:00bit-boosterG. Sylvie Davieshttp://www.blogger.com/profile/07614612712978874539noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-7523918726972316953.post-88002537157829363902016-02-16T18:22:00.002-08:002016-04-19T23:46:23.600-07:00No Foxtrot Merges Allowed In My Git<style type="text/css">
body * { color: black; }
td.cs1, td.cs2, td.cs3 { border: 2px solid black; vertical-align: bottom; padding: 3px; }
tr.caption td { vertical-align: top; }
.bit-booster-tbl, .bit-booster-tbl * { line-height: 1.0; font-family: monospace; border-spacing: 0; margin:0; border: 0; padding: 0; font-size: 16px;}
.bit-booster-tbl span.icon { font-family: "Atlassian Icons"; font-size: 16px; padding-left: 2px; }
.bit-booster-tbl .d { font-style: italic; color: darkgray; padding-left: 0.7em; white-space: nowrap; }
.bit-booster-tbl td.commit { padding: 4px 1px; }
.bit-booster-tbl td.c { text-align: center; font-style: italic; font-size: 12px; border-top: 1px solid black; padding-top: 6px; }
.bit-booster-tbl tr.r td { text-align: right; }
</style>
<br />
<h2>
<span style="font-family: "georgia" , "times new roman" , serif;">
Protect Our Gits, Stop Foxtrots Now!</span></h2>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ_ptMpe2-X0NCpoBTLRAkEuT3kaEEBD2xVkXoIcufTbgxLUgZgDkbf34JII-QBGzIDMhwKyWQqkvJhgXC1n-41HjFWOoFwzMATnnd1vQX39-hhJTZkG5EW1L4_ZIvThqreVUJFTZgBFn6/s1600/dance.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><span style="color: black; font-family: "georgia" , "times new roman" , serif;"><img border="0" height="324" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ_ptMpe2-X0NCpoBTLRAkEuT3kaEEBD2xVkXoIcufTbgxLUgZgDkbf34JII-QBGzIDMhwKyWQqkvJhgXC1n-41HjFWOoFwzMATnnd1vQX39-hhJTZkG5EW1L4_ZIvThqreVUJFTZgBFn6/s640/dance.jpg" width="640" /></span></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: "georgia" , "times new roman" , serif;">Notice how those who stopped their foxtrots are happier. Lizadaly, <a href="https://www.flickr.com/photos/lizadaly/3091168354/">Flickr</a>, <a href="https://creativecommons.org/licenses/by/2.0/">CC By 2.0</a>.</span></td></tr>
</tbody></table>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
</span><br />
<h2>
<span style="font-family: "georgia" , "times new roman" , serif;">
First, what is a foxtrot merge?</span></h2>
<span style="font-family: "georgia" , "times new roman" , serif;"><b><br /></b>
</span><br />
<div>
<span style="font-family: "georgia" , "times new roman" , serif;">A foxtrot merge is a specific sequence of git commits. A particularly nefarious sequence. Out in the open, in lush open grasslands, the sequence looks like this:</span></div>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
</span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQLUo01Tmt4JMQC8QuKmPUA0h1R77RQy7vkz3Y7WM_Y-uarSjXT0djWXhmdiYFvmktdBtJ3eYFQDGSCDneebUQoiQ6VOYGcTZGrjCRUWz2xKqwRPllIsTuZ_GAJkW5KWbUNhHRAWpkvU2G/s1600/foxtrot.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><span style="color: black; font-family: "georgia" , "times new roman" , serif;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQLUo01Tmt4JMQC8QuKmPUA0h1R77RQy7vkz3Y7WM_Y-uarSjXT0djWXhmdiYFvmktdBtJ3eYFQDGSCDneebUQoiQ6VOYGcTZGrjCRUWz2xKqwRPllIsTuZ_GAJkW5KWbUNhHRAWpkvU2G/s200/foxtrot.png" width="87" /></span></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><br /></td></tr>
</tbody></table>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: inherit;">But foxtrots are rarely seen in the open. They hide up in the canopy, inbetween the branches. I call them foxtrots because, when caught mid-pounce, they look like the foot sequence for the eponymous ballroom dance:</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: inherit;"><br /></span>
</span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><span style="margin-left: auto; margin-right: auto;"><a href="http://heartsandlaserbeams.com/"><img alt="" border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEildH2FOGZkhdPKDaUl-lKcjmOUtrfe8WFAglapu3AusKbImELttf3FWv61dd3hy_M3c0i3QM9XF9mp49Mb-rUKMfsO6K2eo7vqFdOF-EUAdVHZiGzTqJz0eLH6wAHGW1cNtldKOf6B3eLJ/s320/foxtrot-steps.jpg" title="" width="245" /></a></span></td></tr>
<tr><td class="tr-caption" style="text-align: start;">Image copyright <span style="color: #1155cc; font-family: "arial" , sans-serif;"><span style="background-color: white; font-size: 12.8px;"><a href="http://heartsandlaserbeams.com/">Hearts and Laserbeams</a></span></span><span style="color: #222222; font-family: "arial" , sans-serif;"><span style="background-color: white;">, used with permission.</span></span></td></tr>
</tbody></table>
<span style="font-family: "georgia" , "times new roman" , serif;">
<span style="font-family: inherit;"><br /></span><span style="font-family: inherit;">Others have blogged about foxtrot merges, but they never name them directly. For example, Junio C. Hamano blogs about having <a href="http://git-blame.blogspot.ca/2012/03/fun-with-first-parent.html">Fun With --First-Parent</a>, as well as <a href="http://git-blame.blogspot.ca/2015/03/fun-with-non-fast-forward.html">Fun With Non-Fast-Forward</a>. David Lowe of nestoria.com talks about <a href="https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwjEo8eKr6nLAhUX3WMKHZCxDm4QFggjMAE&url=http%3A%2F%2Fdevblog.nestoria.com%2Fpost%2F98892582763%2Fmaintaining-a-consistent-linear-history-for-git&usg=AFQjCNEBPLbdeoK6JYaiNtxJW5rQSkihPA&sig2=fkh2EaT0kaOrWh10-3lStw">Maintaining Consistent Linear History</a>. And then there's a <a href="https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjv2ZPLr6nLAhUU0GMKHTGlD5sQFggcMAA&url=http%3A%2F%2Flongair.net%2Fblog%2F2009%2F04%2F16%2Fgit-fetch-and-merge%2F&usg=AFQjCNF_QLroUtXQmEforwTSDd5wpkcLNA&sig2=AXVvC4gLhJ1uaoGlaX8azA">whole</a> <a href="https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwjv2ZPLr6nLAhUU0GMKHTGlD5sQFggjMAE&url=http%3A%2F%2Fkernowsoul.com%2Fblog%2F2012%2F06%2F20%2F4-ways-to-avoid-merge-commits-in-git&usg=AFQjCNGJeh4bcP8-f7mw3F3rnrhs4tI_RQ&sig2=J5b0Pu5pSxjEo1Z2xi8N1A">whack</a> <a href="https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&uact=8&ved=0ahUKEwjv2ZPLr6nLAhUU0GMKHTGlD5sQFggqMAI&url=http%3A%2F%2Fwww.randyfay.com%2Fcontent%2Fsimpler-rebasing-avoiding-unintentional-merge-commits&usg=AFQjCNGczJp741stszJ9NrCqQ2I5teQO6Q&sig2=iWx_AvRIahxlII1wy6z0tw">of</a> <a href="https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uact=8&ved=0ahUKEwjv2ZPLr6nLAhUU0GMKHTGlD5sQFggwMAM&url=https%3A%2F%2Fadamcod.es%2F2014%2F12%2F10%2Fgit-pull-correct-workflow.html&usg=AFQjCNHu1NyM7uNIRzwOWCVVXS5SR7oapA&sig2=wc0SMgd5-CjmVS5KyQCa0Q">people</a> telling you to avoid "git pull" and to always use "git pull --rebase" instead. Why? Mostly to avoid merge commits in general, but also to avoid them darn foxtrot vermin.</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">But are foxtrot merges really bad?</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Yes.</span></span><br />
<div style="text-align: center;">
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
</span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRitBLx1kz2JYNRAW6nlbX4Kk7NzNv2O5nlgphIPDn7Va1c1urc3pc7OkVKLP-vU7Pa7jZAPI-djBWfc4Lc1_1NxPGhnr2iPLOg4h8eQwbR7Qh478Qh0rwA4ycYc735wvmDfL9ce9jWbz4/s1600/jelly.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><span style="color: black; font-family: "georgia" , "times new roman" , serif;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRitBLx1kz2JYNRAW6nlbX4Kk7NzNv2O5nlgphIPDn7Va1c1urc3pc7OkVKLP-vU7Pa7jZAPI-djBWfc4Lc1_1NxPGhnr2iPLOg4h8eQwbR7Qh478Qh0rwA4ycYc735wvmDfL9ce9jWbz4/s320/jelly.jpg" width="320" /></span></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: "georgia" , "times new roman" , serif;">Olaf Gradin, <a href="https://www.flickr.com/photos/gradin/3173206576">Flickr</a>, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-By-SA 2.0</a></span></td></tr>
</tbody></table>
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></div>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: inherit;">They are clearly not as bad as the <span style="letter-spacing: -0.02em; line-height: 30px;">Portuguese Man o’ War. </span></span>But foxtrot merges are bad, and you do not want them creeping into your git repositories.</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
</span><br />
<h2>
<span style="font-family: "georgia" , "times new roman" , serif;">
Why are foxtrot merges bad?</span></h2>
<span style="font-family: "georgia" , "times new roman" , serif;">Foxtrot merges are bad because they change <i>origin/master's</i> first-parent history.</span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;">The parents of a merge commit are ordered. </span>The 1st parent is HEAD. </span><span style="font-family: "georgia" , "times new roman" , serif;">The 2nd parent is the commit you reference with the "git merge" command.</span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">You can think of it like this:</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">git checkout 1st-parent</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git merge 2nd-parent</span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">And if you are of the <a href="http://marc.info/?l=linux-kernel&m=139033182525831">octopus persuasion</a>:</span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">git merge 2nd-parent 3rd-parent 4th-parent ... 8th-parent etc...</span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;">This means first-parent history is exactly like it sounds. It's the history you get when you omit all parents except the first one for each commit. For regular commits (non-merges) the first parent is the only parent, and for merges it was the commit you were on when you typed "git merge." </span>This notion of first-parent is built right into Git, and appears in many of the commands, e.g., "git log --first-parent." </span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">The problem with foxtrot merges is they cause <i>origin/master</i> to merge as a 2nd parent.</span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">Which would be fine except that Git doesn't care about parent-order when it evaluates whether a commit is eligible for fast-forward. </span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">And you really don't want that. You don't want foxtrot merges updating <i>origin/master</i> via fast-forward. It makes the first-parent history unstable.</span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">Look what happens when a foxtrot merge is pushed:</span><br />
<!-- http://bit-booster.com/graph.html DATA WAS:
D|C B
C|A
B|A|origin/master
A|x
-->
<br />
<table style="margin-left: auto; margin-right: auto;"><tbody>
<tr>
<td class="cs1" style="vertical-align: bottom;"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="4" style="vertical-align: top;"><span style="font-family: "georgia" , "times new roman" , serif;"><svg height="69" id="bit-booster" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="39" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M24,35C25,61.25,8,43.75,9,59" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,59L9,94" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,35L9,59" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,11L24,35" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<circle cx="9" cy="59" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="9" cy="35" fill="#034f84" id="C_B" r="4" stroke="none"></circle>
<circle cx="24" cy="11" fill="#79c753" id="C_C" r="4" stroke="none"></circle>
</svg>
</span></td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">C</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">B</span></td>
<td class="d"><span style="font-family: "georgia" , "times new roman" , serif;">origin/master
</span></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">A</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr><td class="c" colspan="5"><span style="font-family: "georgia" , "times new roman" , serif;">One commit behind<br />master</span></td></tr>
</tbody>
</table>
</td>
<td style="padding: 2em; vertical-align: middle;"><span style="font-family: "georgia" , "times new roman" , serif;"><b><i>git<br />pull</i><br />---></b>
</span></td><td class="cs2"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="5" style="vertical-align: top;"><span style="font-family: "georgia" , "times new roman" , serif;"><svg height="89.18182373046875" id="bit-booster" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="54" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M39,33.72727966308594C40,59.97727966308594,8,42.47727966308594,9,56.45454406738281" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,11C23,37.25,40,19.75,39,33.72727966308594" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,56.45454406738281C25,82.70454406738281,8,65.20454406738281,9,79.18182373046875" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,79.18182373046875L9,114.18182373046875" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,56.45454406738281L9,79.18182373046875" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,33.72727966308594L24,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,11L24,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M39,33.72727966308594L39,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<circle cx="9" cy="79.18182373046875" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="9" cy="56.45454406738281" fill="#034f84" id="C_B" r="4" stroke="none"></circle>
<circle cx="24" cy="33.72727966308594" fill="#79c753" id="C_C" r="4" stroke="none"></circle>
<circle cx="24" cy="11" fill="#79c753" id="C_D" r="4" stroke="none"></circle>
</svg>
</span></td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="D" id="T_D">
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">D</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">C</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">B</span></td>
<td class="d"><span style="font-family: "georgia" , "times new roman" , serif;">origin/master
</span></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">A</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr><td class="c" colspan="5"><span style="font-family: "georgia" , "times new roman" , serif;">Eek, foxtrot!</span></td></tr>
</tbody>
</table>
</td><td style="padding: 2em; vertical-align: middle;"><span style="font-family: "georgia" , "times new roman" , serif;"><b><i>git<br />push</i><br />---></b>
</span></td>
<td class="cs3"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="5" style="vertical-align: top;"><span style="font-family: "georgia" , "times new roman" , serif;"><svg height="89.18182373046875" id="bit-booster" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="39" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M9,11C8,37.25,25,19.75,24,33.72727966308594" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,56.45454406738281C25,82.70454406738281,8,65.20454406738281,9,79.18182373046875" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,79.18182373046875L9,114.18182373046875" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,56.45454406738281L24,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,33.72727966308594L9,79.18182373046875" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,11L9,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,33.72727966308594L24,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<circle cx="9" cy="79.18182373046875" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="24" cy="56.45454406738281" fill="#79c753" id="C_B" r="4" stroke="none"></circle>
<circle cx="9" cy="33.72727966308594" fill="#034f84" id="C_C" r="4" stroke="none"></circle>
<circle cx="9" cy="11" fill="#034f84" id="C_D" r="4" stroke="none"></circle>
</svg>
</span></td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="D" id="T_D">
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">D</span></td>
<td class="d"><span style="font-family: "georgia" , "times new roman" , serif;">origin/master
</span></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">C</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">B</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">A</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr><td class="c" colspan="5"><span style="font-family: "georgia" , "times new roman" , serif;">Uhh, B, you're there?</span></td></tr>
</tbody>
</table>
</td></tr>
</tbody></table>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span><span style="font-family: "georgia" , "times new roman" , serif;">You can calculate the first-parent history yourself by tracing the graph with your finger starting from <i>origin/master</i> and always going left at every fork.</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;">The problem is that initially the first-parent sequence of commits (starting from <i>origin/master</i>) is this:</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;"> <i>B, A</i></span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">But after the foxtrot merge is pushed, the first-parent sequence becomes this:</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;"> <i>D, C, A</i></span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">Commit <i>B</i> has vanished from the <i>origin-master</i>'s first-parent history.</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">No work is lost, and commit <i>B</i> is still part of <i>origin/master</i> of course.</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">But first-parent turns out to have all sorts of implications. Did you know that the tilda notation (e.g., <commit>~<i>N</i>) specifies the <i>Nth</i> commit down the first-parent path from the given commit?</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">Have you ever wanted to see each commit on your branch as a diff, but "git log -p" is clearly missing diffs, and "git log -p -m" has way too many diffs?</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;">Try "git log -p -m --first-parent" instead.</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;">Have you ever wanted to revert a merge? You need to supply the "</span>-m parent-number" option to "git revert" to do that, and you really don't want to provide the wrong parent-number.</span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">Most people I work with treat the first-parent sequence as the real "master" branch. Either consciously or subconsciously, people see "git log --first-parent origin/master" as the sequence of the important things. As for any side branches merging in? Well, you know what they say:</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;">
</span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMSGjjPQFi_bzfT6MgWOfSwM370JmIZ_t-MCiYfHvfPWQYawbXA9bX3U8datIrDzpiufxjMPUoyxV9W34-XUo-xwbVfZBlcbB1gzh0SsimqXxNpl4Q9t1QkgZGf-QbpTDvhTp6uR3be5I2/s1600/resized_jesus-says.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="color: black; font-family: "georgia" , "times new roman" , serif;"></span></a></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBOHfnnAZIcEZW8_6N4agSW3_YG8_aRTcK1n0Vk-t8H4qHOS5l3HjCAd7zSrV1mFqFEgwKI1LNVj7tpu_bYEu1xVQDxNRCi_S_JFoMgTzMVECBqPNmIP2anJz7jIRjP68hs2DxqyKnEOs_/s1600/cobol-topic.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="What happens in topic branch stays in topic branch." border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBOHfnnAZIcEZW8_6N4agSW3_YG8_aRTcK1n0Vk-t8H4qHOS5l3HjCAd7zSrV1mFqFEgwKI1LNVj7tpu_bYEu1xVQDxNRCi_S_JFoMgTzMVECBqPNmIP2anJz7jIRjP68hs2DxqyKnEOs_/s400/cobol-topic.jpg" title="What happens in topic branch stays in topic branch." width="260" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Phil Manker, <a href="https://www.flickr.com/photos/philmanker/3654636770">Flickr</a>, <a href="https://creativecommons.org/licenses/by/2.0/">CC-BY-2.0</a></td></tr>
</tbody></table>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">But foxtrot merges mess with this. Consider the example below, where a sequence of critical commits hits <i>origin/master</i> in parallel to your own slightly less important work:</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
</span><br />
<table border="0" class="bit-booster-tbl" style="margin-left: auto; margin-right: auto; padding-right: 10em; width: 1%;">
<tbody>
<tr>
<td style="vertical-align: top; width: 99%;"></td>
<td style="vertical-align: top; width: 99%;"></td>
<td rowspan="9" style="vertical-align: top;"><span style="font-family: "georgia" , "times new roman" , serif;"><svg height="189" id="bit-booster" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="39" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M24,155C25,181.25,8,163.75,9,179" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,179L9,214" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,155L9,179" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,131L9,155" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,107L24,155" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,83L9,131" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,59L9,83" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,35L24,107" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,11L24,35" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<circle cx="9" cy="179" fill="#034f84" id="C_BUG-106" r="4" stroke="none"></circle>
<circle cx="9" cy="155" fill="#034f84" id="C_CRITICAL-14" r="4" stroke="none"></circle>
<circle cx="9" cy="131" fill="#034f84" id="C_URGENT-88" r="4" stroke="none"></circle>
<circle cx="24" cy="107" fill="#79c753" id="C_1st_draft" r="4" stroke="none"></circle>
<circle cx="9" cy="83" fill="#034f84" id="C_SHOWSTOPPER-123" r="4" stroke="none"></circle>
<circle cx="9" cy="59" fill="#034f84" id="C_STOP_THE_WORLD_NOW" r="4" stroke="none"></circle>
<circle cx="24" cy="35" fill="#79c753" id="C_my_experiment" r="4" stroke="none"></circle>
<circle cx="24" cy="11" fill="#79c753" id="C_final_cleanup" r="4" stroke="none"></circle>
</svg>
</span></td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="final_cleanup" id="T_final_cleanup">
<td colspan="2"></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">final_cleanup</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="my_experiment" id="T_my_experiment">
<td colspan="2"></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">my_experiment</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="STOP_THE_WORLD_NOW" id="T_STOP_THE_WORLD_NOW">
<td class="d" style="padding-left: 0; padding-right: 0.7em;"><span style="font-family: "georgia" , "times new roman" , serif;"><em class="d">origin/master</em></span></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">STOP_THE_WORLD_NOW</span></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="SHOWSTOPPER-123" id="T_SHOWSTOPPER-123">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">SHOWSTOPPER-123</span></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="1st_draft" id="T_1st_draft">
<td></td>
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">1st_draft</span></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="URGENT-88" id="T_URGENT-88">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">URGENT-88</span></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="CRITICAL-14" id="T_CRITICAL-14">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">CRITICAL-14</span></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="BUG-106" id="T_BUG-106">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">BUG-106</span></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">At this point you're finally ready to bring your work into master. You type "git pull," or maybe you're on a topic branch and you type "git merge master". What happens? A foxtrot merge happens.
</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></span>
<br />
<table border="0" class="bit-booster-tbl" style="margin-left: auto; margin-right: auto; padding-right: 10em; width: 1%;">
<tbody>
<tr>
<td style="vertical-align: top; width: 99%;"></td>
<td style="vertical-align: top; width: 99%;"></td>
<td rowspan="10" style="vertical-align: top;"><span style="font-family: "georgia" , "times new roman" , serif;"><svg height="213" id="bit-booster" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="54" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M39,59C40,85.25,8,67.75,9,83" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,11C23,37.25,40,19.75,39,35" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,179C25,205.25,8,187.75,9,203" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,203L9,238" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,179L9,203" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,155L9,179" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,131L24,179" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,107L9,155" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,83L9,107" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,59L24,131" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,35L24,59" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,11L24,35" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M39,35L39,59" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<circle cx="9" cy="203" fill="#034f84" id="C_BUG-106" r="4" stroke="none"></circle>
<circle cx="9" cy="179" fill="#034f84" id="C_CRITICAL-14" r="4" stroke="none"></circle>
<circle cx="9" cy="155" fill="#034f84" id="C_URGENT-88" r="4" stroke="none"></circle>
<circle cx="24" cy="131" fill="#79c753" id="C_1st_draft" r="4" stroke="none"></circle>
<circle cx="9" cy="107" fill="#034f84" id="C_SHOWSTOPPER-123" r="4" stroke="none"></circle>
<circle cx="9" cy="83" fill="#034f84" id="C_STOP_THE_WORLD_NOW" r="4" stroke="none"></circle>
<circle cx="24" cy="59" fill="#79c753" id="C_my_experiment" r="4" stroke="none"></circle>
<circle cx="24" cy="35" fill="#79c753" id="C_final_cleanup" r="4" stroke="none"></circle>
<circle cx="24" cy="11" fill="#79c753" id="C_foxtrot" r="4" stroke="none"></circle>
</svg>
</span></td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="foxtrot" id="T_foxtrot">
<td colspan="2"></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">foxtrot</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="final_cleanup" id="T_final_cleanup">
<td colspan="2"></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">final_cleanup</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="my_experiment" id="T_my_experiment">
<td colspan="2"></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">my_experiment</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="STOP_THE_WORLD_NOW" id="T_STOP_THE_WORLD_NOW">
<td class="d" style="padding-left: 0; padding-right: 0.7em;"><span style="font-family: "georgia" , "times new roman" , serif;"><em class="d">origin/master</em></span></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">STOP_THE_WORLD_NOW</span></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="SHOWSTOPPER-123" id="T_SHOWSTOPPER-123">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">SHOWSTOPPER-123</span></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="1st_draft" id="T_1st_draft">
<td colspan="2"></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">1st_draft</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="URGENT-88" id="T_URGENT-88">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">URGENT-88</span></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="CRITICAL-14" id="T_CRITICAL-14">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">CRITICAL-14</span></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="BUG-106" id="T_BUG-106">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">BUG-106</span></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">This wouldn't really be of any concern. Except when you type "git push" and your remote repo accepts it. Because now your history looks like this:
</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></span>
<br />
<table border="0" class="bit-booster-tbl" style="margin-left: auto; margin-right: auto; padding-left: 1em; padding-right: 0; width: 1%;">
<tbody>
<tr>
<td style="vertical-align: top; width: 99%;"></td>
<td style="vertical-align: top; width: 99%;"></td>
<td rowspan="10" style="vertical-align: top;"><span style="font-family: "georgia" , "times new roman" , serif;"><svg height="213" id="bit-booster" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="39" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M9,11C8,37.25,25,19.75,24,35" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,179C25,205.25,8,187.75,9,203" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,203L9,238" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,179L24,179" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,155L24,179" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,131L9,203" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,107L24,155" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,83L24,107" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,59L9,131" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,35L9,59" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,11L9,35" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,35L24,83" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<circle cx="9" cy="203" fill="#034f84" id="C_BUG-106" r="4" stroke="none"></circle>
<circle cx="24" cy="179" fill="#79c753" id="C_CRITICAL-14" r="4" stroke="none"></circle>
<circle cx="24" cy="155" fill="#79c753" id="C_URGENT-88" r="4" stroke="none"></circle>
<circle cx="9" cy="131" fill="#034f84" id="C_1st_draft" r="4" stroke="none"></circle>
<circle cx="24" cy="107" fill="#79c753" id="C_SHOWSTOPPER-123" r="4" stroke="none"></circle>
<circle cx="24" cy="83" fill="#79c753" id="C_STOP_THE_WORLD_NOW" r="4" stroke="none"></circle>
<circle cx="9" cy="59" fill="#034f84" id="C_my_experiment" r="4" stroke="none"></circle>
<circle cx="9" cy="35" fill="#034f84" id="C_final_cleanup" r="4" stroke="none"></circle>
<circle cx="9" cy="11" fill="#034f84" id="C_foxtrot" r="4" stroke="none"></circle>
</svg>
</span></td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr class="r" data-commitid="foxtrot" id="T_foxtrot">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;"><em class="d">origin/master</em> foxtrot</span></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="final_cleanup" id="T_final_cleanup">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">final_cleanup</span></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="my_experiment" id="T_my_experiment">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">my_experiment</span></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="STOP_THE_WORLD_NOW" id="T_STOP_THE_WORLD_NOW">
<td colspan="2"></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">STOP_THE_WORLD_NOW</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="SHOWSTOPPER-123" id="T_SHOWSTOPPER-123">
<td colspan="2"></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">SHOWSTOPPER-123</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="r" data-commitid="1st_draft" id="T_1st_draft">
<td></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">1st_draft</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="URGENT-88" id="T_URGENT-88">
<td colspan="2"></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">URGENT-88</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="CRITICAL-14" id="T_CRITICAL-14">
<td colspan="2"></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">CRITICAL-14</span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="BUG-106" id="T_BUG-106">
<td colspan="2"></td>
<td class="commit"><span style="font-family: "georgia" , "times new roman" , serif;">BUG-106</span></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
</span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img alt="Topic branch escaped!" border="0" height="281" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGv6W6pkqPk2QyaXlmLVwXo0O7c_je6eVqsWsiC3JFhaYZpGdou0_3r27c9TmpSKQsStqCNY1FKfWYi1yrSahYfxXWZ-0qfIs71HTaw-3M4c4RUqcvDb-IGT5jHNNrFPOLTvMDWHj0u3R6/s320/topic-branch-escaped.jpg" style="margin-left: auto; margin-right: auto;" title="Topic branch escaped!" width="320" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">justlego101, <a href="https://www.flickr.com/photos/103739566@N06/25044723391/">Flickr</a>, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA 2.0</a></td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGv6W6pkqPk2QyaXlmLVwXo0O7c_je6eVqsWsiC3JFhaYZpGdou0_3r27c9TmpSKQsStqCNY1FKfWYi1yrSahYfxXWZ-0qfIs71HTaw-3M4c4RUqcvDb-IGT5jHNNrFPOLTvMDWHj0u3R6/s1600/topic-branch-escaped.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="color: black; font-family: "georgia" , "times new roman" , serif;"></span></a></div>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;"><br /></span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;">
</span>
<br />
<h2>
<span style="font-family: "georgia" , "times new roman" , serif;">What should I do about the pre-existing foxtrot merges that have infected my git repo?</span></h2>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">Nothing. Leave them.</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">Unless you're one of those antisocial people that rewrites master. Then go nuts.</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><br />Actually, <a href="https://www.atlassian.com/git/tutorials/merging-vs-rebasing/the-golden-rule-of-rebasing">please don't</a>.</span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
</span><br />
<h2>
<span style="font-family: "georgia" , "times new roman" , serif;">How can I prevent future foxtrot merges from creeping into my git repo?</span></h2>
<span style="font-family: "georgia" , "times new roman" , serif;"><br />There are a few ways. My favorite approach involves 4 steps:</span><br />
<span style="font-family: "georgia" , "times new roman" , serif;">
</span>
<br />
<ol>
<li><span style="font-family: "georgia" , "times new roman" , serif;">Setup <a href="https://bitbucket.org/product/server">Atlassian Bitbucket Server</a> for your team.</span></li>
<li><span style="font-family: "georgia" , "times new roman" , serif;">Install the add-on I wrote for Bitbucket Server called "Bit Booster Commit Graph and More." You can find it here: <a href="https://marketplace.atlassian.com/plugins/com.bit-booster.bb">https://marketplace.atlassian.com/plugins/com.bit-booster.bb</a></span></li>
<li><span style="font-family: "georgia" , "times new roman" , serif;">Click the "Enable" button on the "Protect First Parent Hook" in all your repos:<br /><br />
</span><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGDZ4Hv19D-Qon5YE_M2E9WefNloq3OoRPs1gUhVKKNo-ILfCgt-5H9vI2AyDvAjmFw4ksJfyz_wOx92TbpfUPR55pupSI11fkn8lHpU-DQ2tx0FcSDSRCgKnVJS-DtB27oPA4uQj8cf9f/s1600/enabled.png" imageanchor="1" style="clear: left; display: block; float: left; margin-bottom: 1em; margin-left: 1em; margin-right: 1em;"><span style="color: black; font-family: "georgia" , "times new roman" , serif;"><img border="0" height="122" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGDZ4Hv19D-Qon5YE_M2E9WefNloq3OoRPs1gUhVKKNo-ILfCgt-5H9vI2AyDvAjmFw4ksJfyz_wOx92TbpfUPR55pupSI11fkn8lHpU-DQ2tx0FcSDSRCgKnVJS-DtB27oPA4uQj8cf9f/s640/enabled.png" width="640" /></span></a><span style="font-family: "georgia" , "times new roman" , serif;">
<br style="clear: left;" />
</span></li>
<li><span style="font-family: "georgia" , "times new roman" , serif;">Call in sick to work for 31 days to make the trial license expire.</span></li>
</ol>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">This is my preferred approach because it keeps the foxtrots away, and it prints a cow whenever a foxtrot is blocked:</span></span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
</span><br />
<pre style="border-radius: 15px; border: 2px solid black; margin-left: auto; margin-right: auto; padding: 8px; width: 65%;"><span style="font-family: "courier new" , "courier" , monospace;">$ git commit -m 'my commit'
$ git pull
$ git push
remote: _____________________________________________
remote: / \
remote: | Moo! Your bit-booster license has expired! |
remote: \ /
remote: ---------------------------------------------
remote: \ ^__^
remote: \ (oo)\_______
remote: (__)\ )\/\
remote: ||----w |
remote: || ||
remote:
remote: *** PUSH REJECTED BY Protect-First-Parent HOOK ***
remote:
remote: Merge [da75830d94f5] is not allowed. *Current* master
remote: must appear in the 'first-parent' position of the
remote: subsequent commit.
remote:</span></pre>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
<span style="font-family: "georgia" , "times new roman" , serif;">There are other ways. You could disable direct pushes to master, and hope that pull-requests never merge with fast-forward.</span></span><span style="font-family: "georgia" , "times new roman" , serif;"><br />Or train your staff to always do "git pull --rebase" and to never type "git merge master" and once all your staff are trained, never hire anyone else.</span><br />
<span style="font-family: "georgia" , "times new roman" , serif;"><br />If you have direct access to the remote repository, you could setup a pre-receive hook. </span><span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;">The following bash script should help you get started:</span></span><br />
<div>
<span style="font-family: "georgia" , "times new roman" , serif;"><span style="font-family: "georgia" , "times new roman" , serif;"><br /></span>
</span><br />
<pre style="border-radius: 15px; border: 2px solid black; margin-left: auto; margin-right: auto; padding: 8px; width: 72%;"><span style="font-family: "courier new" , "courier" , monospace;">#/bin/bash
# Copyright (c) 2016 G. Sylvie Davies. http://bit-booster.com/
# Copyright (c) 2016 torek. http://stackoverflow.com/users/1256452/torek
# License: MIT license. https://opensource.org/licenses/MIT
while read oldrev newrev refname
do
if [ "$refname" = "refs/heads/master" ]; then
MATCH=`git log --first-parent --pretty='%H %P' $oldrev..$newrev |
grep $oldrev |
awk '{ print \$2 }'`
if [ "$oldrev" = "$MATCH" ]; then
exit 0
else
echo "*** PUSH REJECTED! FOXTROT MERGE BLOCKED!!! ***"
exit 1
fi
fi
done</span></pre>
</div>
<h2>
<span style="font-family: "georgia" , "times new roman" , serif;">
I accidentally created a foxtrot merge, but I haven't pushed it. How can I fix it?</span></h2>
<span style="font-family: "georgia" , "times new roman" , serif;">Suppose you install the pre-receive hook, and it blocks your foxtrot.
What do you do next?
You have three possible remedies:</span><br />
<table>
<tbody>
<tr>
<td colspan="3"><br />
<b>1. Simple rebase:</b>
</td>
</tr>
<tr>
<td class="cs1"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="5" style="vertical-align: top;"><svg class="bit-booster" height="89.18182373046875" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="54" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M39,33.72727966308594C40,59.97727966308594,8,42.47727966308594,9,56.45454406738281" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,11C23,37.25,40,19.75,39,33.72727966308594" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,56.45454406738281C25,82.70454406738281,8,65.20454406738281,9,79.18182373046875" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,79.18182373046875L9,114.18182373046875" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,56.45454406738281L9,79.18182373046875" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,33.72727966308594L24,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,11L24,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M39,33.72727966308594L39,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<circle cx="9" cy="79.18182373046875" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="9" cy="56.45454406738281" fill="#034f84" id="C_B" r="4" stroke="none"></circle>
<circle cx="24" cy="33.72727966308594" fill="#79c753" id="C_C" r="4" stroke="none"></circle>
<circle cx="24" cy="11" fill="#79c753" id="C_D" r="4" stroke="none"></circle>
</svg>
</td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="D" id="T_D">
<td class="commit">D</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit">C</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit">B</td>
<td class="d"></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit">A</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
<td class="cs2"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="4" style="vertical-align: top;"><br />
<svg class="bit-booster" height="66.45454406738281" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="39" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M24,11C25,37.25,8,19.75,9,33.72727966308594" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,56.45454406738281L9,91.45454406738281" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,33.72727966308594L9,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,11L24,11" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<circle cx="9" cy="56.45454406738281" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="9" cy="33.72727966308594" fill="#034f84" id="C_B" r="4" stroke="none"></circle>
<circle cx="24" cy="11" fill="#79c753" id="C_C" r="4" stroke="none"></circle>
</svg>
</td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit"><br />
C'</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit">B</td>
<td class="d">origin/master
</td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit">A</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
<td class="cs3"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="4" style="vertical-align: top;"><br />
<svg class="bit-booster" height="66.45454406738281" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="25" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M9,56.45454406738281L9,91.45454406738281" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,33.72727966308594L9,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,11L9,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<circle cx="9" cy="56.45454406738281" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="9" cy="33.72727966308594" fill="#034f84" id="C_B" r="4" stroke="none"></circle>
<circle cx="9" cy="11" fill="#034f84" id="C_C" r="4" stroke="none"></circle>
</svg>
</td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit"><br />
C'</td>
<td class="d"><br />
origin/master
</td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit">B</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit">A</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="caption">
<td>foxtrot
</td>
<td>git rebase origin/master
</td>
<td>git push
</td>
</tr>
<tr><td colspan="3"><br />
<br />
<b>2. Reverse your earlier merge to make origin/master the first-parent:</b>
</td>
</tr>
<tr>
<td class="cs1"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="99999" style="vertical-align: top;"><svg class="bit-booster" height="89.18182373046875" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="54" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M39,33.72727966308594C40,59.97727966308594,8,42.47727966308594,9,56.45454406738281" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,11C23,37.25,40,19.75,39,33.72727966308594" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,56.45454406738281C25,82.70454406738281,8,65.20454406738281,9,79.18182373046875" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,79.18182373046875L9,114.18182373046875" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,56.45454406738281L9,79.18182373046875" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,33.72727966308594L24,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,11L24,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M39,33.72727966308594L39,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<circle cx="9" cy="79.18182373046875" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="9" cy="56.45454406738281" fill="#034f84" id="C_B" r="4" stroke="none"></circle>
<circle cx="24" cy="33.72727966308594" fill="#79c753" id="C_C" r="4" stroke="none"></circle>
<circle cx="24" cy="11" fill="#79c753" id="C_D" r="4" stroke="none"></circle>
</svg>
</td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="D" id="T_D">
<td class="commit">D</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit">C</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit">B</td>
<td class="d"></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit">A</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
<td class="cs2"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="99999" style="vertical-align: top;"><svg class="bit-booster" height="89.18182373046875" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="39" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M24,11C25,37.25,8,19.75,9,33.72727966308594" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,56.45454406738281C25,82.70454406738281,8,65.20454406738281,9,79.18182373046875" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,79.18182373046875L9,114.18182373046875" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,56.45454406738281L9,79.18182373046875" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,33.72727966308594L24,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,33.72727966308594L9,79.18182373046875" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,11L24,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<circle cx="9" cy="79.18182373046875" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="9" cy="56.45454406738281" fill="#034f84" id="C_B" r="4" stroke="none"></circle>
<circle cx="24" cy="33.72727966308594" fill="#79c753" id="C_C" r="4" stroke="none"></circle>
<circle cx="24" cy="11" fill="#79c753" id="C_D" r="4" stroke="none"></circle>
</svg>
</td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="D" id="T_D">
<td class="commit">D'</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit">C</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit">B</td>
<td class="d">origin/master
</td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit">A</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
<td class="cs3"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="99999" style="vertical-align: top;"><svg class="bit-booster" height="89.18182373046875" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="39" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M9,11C8,37.25,25,19.75,24,33.72727966308594" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,56.45454406738281C25,82.70454406738281,8,65.20454406738281,9,79.18182373046875" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,79.18182373046875L9,114.18182373046875" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,56.45454406738281L9,79.18182373046875" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,33.72727966308594L24,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,11L9,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,33.72727966308594L24,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<circle cx="9" cy="79.18182373046875" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="9" cy="56.45454406738281" fill="#034f84" id="C_B" r="4" stroke="none"></circle>
<circle cx="24" cy="33.72727966308594" fill="#79c753" id="C_C" r="4" stroke="none"></circle>
<circle cx="9" cy="11" fill="#034f84" id="C_D" r="4" stroke="none"></circle>
</svg>
</td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="D" id="T_D">
<td class="commit">D'</td>
<td class="d">origin/master
</td>
<td></td>
<td></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit">C</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit">B</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit">A</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="caption">
<td>foxtrot
</td>
<td>git checkout origin/master
<br />
git merge C
</td>
<td>git push origin +HEAD:master
</td>
</tr>
<tr><td colspan="3"><br />
<br />
<b>3. Create a 2nd merge commit after the foxtrot merge to<br /> preserve origin/master's --first-parent relation.</b>
</td>
</tr>
<tr><td class="cs1"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="99999" style="vertical-align: top;"><svg class="bit-booster" height="89.18182373046875" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="54" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M39,33.72727966308594C40,59.97727966308594,8,42.47727966308594,9,56.45454406738281" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,11C23,37.25,40,19.75,39,33.72727966308594" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,56.45454406738281C25,82.70454406738281,8,65.20454406738281,9,79.18182373046875" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,79.18182373046875L9,114.18182373046875" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,56.45454406738281L9,79.18182373046875" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,33.72727966308594L24,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,11L24,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M39,33.72727966308594L39,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<circle cx="9" cy="79.18182373046875" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="9" cy="56.45454406738281" fill="#034f84" id="C_B" r="4" stroke="none"></circle>
<circle cx="24" cy="33.72727966308594" fill="#79c753" id="C_C" r="4" stroke="none"></circle>
<circle cx="24" cy="11" fill="#79c753" id="C_D" r="4" stroke="none"></circle>
</svg>
</td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="D" id="T_D">
<td class="commit">D</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit">C</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit">B</td>
<td class="d"></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit">A</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
<td class="cs2"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="99999" style="vertical-align: top;"><svg class="bit-booster" height="111.90908813476562" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="54" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M24,11C25,37.25,8,19.75,9,33.72727966308594" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M39,56.45454406738281C40,82.70454406738281,8,65.20454406738281,9,79.18182373046875" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,33.72727966308594C23,59.97727966308594,40,42.47727966308594,39,56.45454406738281" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,79.18182373046875C25,105.43182373046875,8,87.93182373046875,9,101.90908813476562" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,101.90908813476562L9,136.90908813476562" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,79.18182373046875L9,101.90908813476562" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,56.45454406738281L24,79.18182373046875" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,33.72727966308594L24,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M39,56.45454406738281L39,56.45454406738281" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M9,33.72727966308594L9,101.90908813476562" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,11L24,33.72727966308594" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<circle cx="9" cy="101.90908813476562" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="9" cy="79.18182373046875" fill="#034f84" id="C_B" r="4" stroke="none"></circle>
<circle cx="24" cy="56.45454406738281" fill="#79c753" id="C_C" r="4" stroke="none"></circle>
<circle cx="24" cy="33.72727966308594" fill="#79c753" id="C_D" r="4" stroke="none"></circle>
<circle cx="24" cy="11" fill="#79c753" id="C_E" r="4" stroke="none"></circle>
</svg>
</td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="E" id="T_E">
<td class="commit">E</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="D" id="T_D">
<td class="commit">D</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit">C</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit">B</td>
<td class="d">origin/master
</td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit">A</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
<td class="cs3"><table class="bit-booster-tbl" style="width: 1%;">
<tbody>
<tr>
<td rowspan="99999" style="vertical-align: top;"><svg class="bit-booster" height="111.90908408164975" style="border: 0px; margin: 0px; padding: 0;" text-rendering="optimizeLegibility" width="54" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M9,11C8,37.25,25,19.75,24,33.72727179527283" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M39,56.45454382896423C40,82.70454382896423,8,65.20454382896423,9,79.18181204795837" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,33.72727179527283C23,59.97727179527283,40,42.47727179527283,39,56.45454382896423" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M24,79.18181204795837C25,105.43181204795837,8,87.93181204795837,9,101.90908408164975" fill="none" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M9,101.90908408164975L9,136.90908408164975" opacity="1" stroke-dasharray="15,3,3,3,3,3,3,3,3,3,3" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M9,79.18181204795837L9,101.90908408164975" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,56.45454382896423L24,79.18181204795837" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M24,33.72727179527283L24,56.45454382896423" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<path d="M39,56.45454382896423L39,56.45454382896423" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#f7786b"></path>
<path d="M9,11L9,79.18181204795837" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#034f84"></path>
<path d="M24,33.72727179527283L24,33.72727179527283" opacity="1" stroke-opacity="1" stroke-width="2" stroke="#79c753"></path>
<circle cx="9" cy="101.90908408164975" fill="#034f84" id="C_A" r="4" stroke="none"></circle>
<circle cx="9" cy="79.18181204795837" fill="#034f84" id="C_B" r="4" stroke="none"></circle>
<circle cx="24" cy="56.45454382896423" fill="#79c753" id="C_C" r="4" stroke="none"></circle>
<circle cx="24" cy="33.72727179527283" fill="#79c753" id="C_D" r="4" stroke="none"></circle>
<circle cx="9" cy="11" fill="#034f84" id="C_E" r="4" stroke="none"></circle>
</svg>
</td>
<td style="vertical-align: top; width: 99%;"></td>
</tr>
<tr data-commitid="E" id="T_E">
<td class="commit">E</td>
<td class="d">origin/master
</td>
<td></td>
<td></td>
</tr>
<tr data-commitid="D" id="T_D">
<td class="commit">D</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="C" id="T_C">
<td class="commit">C</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="B" id="T_B">
<td class="commit">B</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-commitid="A" id="T_A">
<td class="commit">A</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="caption">
<td>foxtrot
</td>
<td>git checkout origin/master<br />
git merge --no-ff D
</td>
<td>git push origin +HEAD:master
</td>
</tr>
</tbody></table>
<br />
.<br />
<h2>
Conclusion</h2>
<div>
At the end of the day a foxtrot merge is just like any other merge. Two (or more) commits come together to reconcile separate development histories. As far as your codebase is concerned, it makes no difference. Whether commit <i>A </i>merges into commit <i>B</i> or vice versa, the end result from a code perspective is identical.</div>
<div>
<br /></div>
<div>
But when it comes to your repository's history, as well as using the git toolset effectively, foxtrot merges create havoc. By setting up policy to prevent them, you make your history easier to understand, and you reduce the range of git command options you need to memorize.<br />
<br />
<br /></div>
<h2>
Final word: please don't ever do foxtrot remedy #3, because the final result of that is called a "Portuguese man o' war merge," and those guys are even worse than foxtrot merges.
</h2>
<div>
<br /></div>
<i>Footnote: Did you like the git graphs in this blog post? You can make similar git graphs for your own blog posts using the git-graph-drawing-tool: <a href="http://bit-booster.com/graph.html">http://bit-booster.com/graph.html</a>. You can also install the <a href="https://marketplace.atlassian.com/plugins/com.bit-booster.bb">Bit-Booster Commit Graph</a> add-on for <a href="https://www.atlassian.com/software/bitbucket/download">Bitbucket Server</a> to block foxtrots AND see nice git graphs like these *right* in your own repositories!</i><br />
<br />G. Sylvie Davieshttp://www.blogger.com/profile/07614612712978874539noreply@blogger.com10