<?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>GL.IB.LY &#187; binary</title>
	<atom:link href="http://gl.ib.ly/tag/binary/feed/" rel="self" type="application/rss+xml" />
	<link>http://gl.ib.ly</link>
	<description>Thoughts on security, computing, business and stuff!</description>
	<lastBuildDate>Sun, 18 May 2014 11:51:56 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>Fixing binary merge conflicts in git</title>
		<link>http://gl.ib.ly/stuff/2009/09/03/fixing-binary-merge-conflicts-git/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fixing-binary-merge-conflicts-git</link>
		<comments>http://gl.ib.ly/stuff/2009/09/03/fixing-binary-merge-conflicts-git/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 06:59:37 +0000</pubDate>
		<dc:creator><![CDATA[tariq]]></dc:creator>
				<category><![CDATA[Stuff]]></category>
		<category><![CDATA[binary]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[mergetool]]></category>
		<category><![CDATA[one liners]]></category>
		<category><![CDATA[opendiff]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[tidbits]]></category>

		<guid isPermaLink="false">http://gl.ib.ly/?p=86</guid>
		<description><![CDATA[<p>Git is an awesome tool for managing your code. However, it does take a while to get used to doing things in git. One question I get asked a bit too often is &#8220;how do I resolve binary merge conflicts&#8221;?<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://gl.ib.ly/stuff/2009/09/03/fixing-binary-merge-conflicts-git/">Read more &#8250;</a></div><!-- end of .read-more --></p><p>The post <a href="http://gl.ib.ly/stuff/2009/09/03/fixing-binary-merge-conflicts-git/">Fixing binary merge conflicts in git</a> appeared first on <a href="http://gl.ib.ly">GL.IB.LY</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><span style="color: #545454;">Git is an awesome tool for managing your code. However, it does take a while to get used to doing things in git. One question I get asked a bit too often is &#8220;how do I resolve binary merge conflicts&#8221;? Thankfully this is is pretty easy. I usually run the </span><code style="color: #545454;">git mergetool</code><span style="color: #545454;"> command to allow me to resolve merge conflicts using a graphical interface and then manipulate the resultant files on the command line. </span><br style="color: #545454;" /><br style="color: #545454;" /></p>
<blockquote style="color: #76767a;"><p>You can specify which editor to use in your <code>~/.gitconfig</code> file. Favourites are <i>kdiff3</i>, <i>vimdiff</i>, <i>xxdiff</i>, and <i>opendiff</i>. If your on Mac OSX then you may be used to FileMerge, in which case you should be using <i>opendiff</i> in your <code>.gitconfig</code>; see below.</p>
<div><code>...<br />
[merge]<br />
tool = opendiff<br />
...<br />
</code></div>
</blockquote>
<p><br style="color: #545454;" /><br style="color: #545454;" /><span style="color: #545454;">So, when you are using mergetool option you will something like:</span></p>
<div style="color: #545454;"><code>Normal merge conflict for 'lib/yui/assets/skins/sam/editor-sprite.gif':<br />
{local}: created<br />
{remote}: created<br />
Hit return to start merge resolution tool (opendiff):<br />
</code></div>
<p><br style="color: #545454;" /><br style="color: #545454;" /><span style="color: #545454;">I just hit return so the editor opens, it will probably warn you the file is binary. In a separate terminal window navigate to the directory where the file is in and do an </span><code style="color: #545454;">ls</code><span style="color: #545454;">; you&#8217;ll see something like what is below:</span></p>
<div style="color: #545454;"><code>editor-sprite.gif<br />
editor-sprite.gif.BACKUP.41930.gif<br />
editor-sprite.gif.LOCAL.41930.gif<br />
editor-sprite.gif.REMOTE.41930.gif<br />
</code></div>
<p><br style="color: #545454;" /><br style="color: #545454;" /><span style="color: #545454;">In this case editor-sprite.gif.REMOTE.41930.gif is the new file and editor-sprite.gif is the original file. To resolve the conflict just copy the REMOTE file over the original file. In my case it would be </span><code style="color: #545454;">cp editor-sprite.gif.REMOTE.41930.gif editor-sprite.gif</code><span style="color: #545454;">. However, I use the following one liner to resolve these conflicts more generically.</span></p>
<div class="geshi" style="color: #545454;"><span style="font-weight: bold; color: #c20cb9;">ls</span> *.REMOTE.* | <span style="font-weight: bold; color: #c20cb9;">sed</span> <span style="color: #ff0000;">&#8220;s/\(\(.*\).REMOTE.*\)/cp \1 \2/g&#8221;</span> | <span style="font-weight: bold; color: #c20cb9;">sh</span></div>
<p><br style="color: #545454;" /><span style="color: #545454;">I have it in shell script in my path so I just run it when I need to resolve these types of conflicts. It just finds files with </span><i style="color: #545454;">REMOTE</i><span style="color: #545454;"> in them and then issues a </span><code style="color: #545454;">cp</code><span style="color: #545454;"> command to copy that file over the original.</span><br style="color: #545454;" /><br style="color: #545454;" /><span style="color: #545454;">Hope this helps!</span><br style="color: #545454;" /><br style="color: #545454;" /></p>
<blockquote style="color: #76767a;"><p>Outside of <i>git mergetool</i> you can just add the binary files using <i>git add file1 file2 &#8230;</i>.</p></blockquote>
<p>&nbsp;</p>
<p>The post <a href="http://gl.ib.ly/stuff/2009/09/03/fixing-binary-merge-conflicts-git/">Fixing binary merge conflicts in git</a> appeared first on <a href="http://gl.ib.ly">GL.IB.LY</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gl.ib.ly/stuff/2009/09/03/fixing-binary-merge-conflicts-git/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
