<?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>eXpand yOur cReativity &#187; merge</title>
	<atom:link href="http://blog.bhushangahire.net/tag/merge/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bhushangahire.net</link>
	<description>by Bhushan G Ahire</description>
	<lastBuildDate>Mon, 26 Jul 2010 10:25:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Keep either file in merge conflicts with git</title>
		<link>http://blog.bhushangahire.net/2009/02/26/keep-either-file-in-merge-conflicts-with-git/</link>
		<comments>http://blog.bhushangahire.net/2009/02/26/keep-either-file-in-merge-conflicts-with-git/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 08:41:29 +0000</pubDate>
		<dc:creator>Bhushan Ahire</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[commit]]></category>
		<category><![CDATA[merge]]></category>

		<guid isPermaLink="false">http://blog.bhushangahire.net/?p=61</guid>
		<description><![CDATA[

So, the scenario is: you’re in the middle of a merge, and you want to keep one file or the other.
$ git merge master
  Auto-merged _layouts/default.html
  CONFLICT (content): Merge conflict in _layouts/default.html
  Auto-merged index.html
  CONFLICT (content): Merge conflict in index.html
  Automatic merge failed; fix conflicts and then commit the result.
There’s [...]]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.bhushangahire.net%2F2009%2F02%2F26%2Fkeep-either-file-in-merge-conflicts-with-git%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<div id="post" class="grid_8 alpha content">
<p>So, the scenario is: you’re in the middle of a merge, and you want to keep one file or the other.</p>
<blockquote><p>$ git merge master<br />
  Auto-merged _layouts/default.html<br />
  CONFLICT (content): Merge conflict in _layouts/default.html<br />
  Auto-merged index.html<br />
  CONFLICT (content): Merge conflict in index.html<br />
  Automatic merge failed; fix conflicts and then commit the result.</p></blockquote>
<p>There’s two unmerged files here. According to the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html">git checkout</a> manpage, there’s a <code>--theirs</code> and <code>--ours</code> options on the command. The former will keep the version of the file that you merged in, and the other will keep the original one we had.</p>
<p>The following commands will keep the original file for index.html, and then use the merged in file only for _layouts/default.html.</p>
<blockquote><p>git checkout &#8211;ours index.html<br />
git checkout &#8211;theirs _layouts/default.html</p></blockquote>
<p>Sadly, these options are only in Git versions 1.6.1 and up. If you have an older version and don’t feel like upgrading, there’s ways to get around this. To emulate <code>--theirs</code>, we’d do:</p>
<blockquote><p>git reset &#8212; _layouts/default.html<br />
git checkout MERGE_HEAD &#8212; _layouts/default.html</p></blockquote>
<p>And for <code>--ours</code>:</p>
<blockquote><p>git reset &#8212; index.html<br />
git checkout ORIG_HEAD &#8212; index.html</p></blockquote>
<p>Of course, once you’ve got the conflicts worked out, <code>git add</code> whatever changes need to be added in, and <code>git commit</code> away. If you’ve run into other problems with merging that could possibly help out others, comment away!</p>
<p><br/><br />
referred from <a href='http://gitready.com/advanced/2009/02/25/keep-either-file-in-merge-conflicts.html'>http://gitready.com/advanced/2009/02/25/keep-either-file-in-merge-conflicts.html</a>
</div>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://blog.bhushangahire.net/2009/02/26/keep-either-file-in-merge-conflicts-with-git/&amp;title=Keep+either+file+in+merge+conflicts+with+git" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.bhushangahire.net/2009/02/26/keep-either-file-in-merge-conflicts-with-git/&amp;title=Keep+either+file+in+merge+conflicts+with+git" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.bhushangahire.net/2009/02/26/keep-either-file-in-merge-conflicts-with-git/&amp;title=Keep+either+file+in+merge+conflicts+with+git" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://blog.bhushangahire.net/2009/02/26/keep-either-file-in-merge-conflicts-with-git/" rel="nofollow" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.bhushangahire.net/2009/02/26/keep-either-file-in-merge-conflicts-with-git/&amp;t=Keep+either+file+in+merge+conflicts+with+git" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Keep+either+file+in+merge+conflicts+with+git+-+http://tr.im/SURR+(via+@bhushangahire)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://blog.bhushangahire.net/2009/02/26/keep-either-file-in-merge-conflicts-with-git/&amp;title=Keep+either+file+in+merge+conflicts+with+git&amp;summary=%0A%0ASo%2C%20the%20scenario%20is%3A%20you%E2%80%99re%20in%20the%20middle%20of%20a%20merge%2C%20and%20you%20want%20to%20keep%20one%20file%20or%20the%20other.%0A%24%20git%20merge%20master%0A%20%20Auto-merged%20_layouts%2Fdefault.html%0A%20%20CONFLICT%20%28content%29%3A%20Merge%20conflict%20in%20_layouts%2Fdefault.html%0A%20%20Auto-merged%20index.html%0A%20%20CONFLICT%20%28content%29%3A%20Merge%20conflict%20in%20index.html%0A%20%20Aut&amp;source=eXpand yOur cReativity" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-tumblr">
			<a href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fblog.bhushangahire.net%2F2009%2F02%2F26%2Fkeep-either-file-in-merge-conflicts-with-git%2F&amp;t=Keep+either+file+in+merge+conflicts+with+git" rel="nofollow" title="Share this on Tumblr">Share this on Tumblr</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.bhushangahire.net/2009/02/26/keep-either-file-in-merge-conflicts-with-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
