<?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></description>
	<lastBuildDate>Thu, 05 Jan 2012 07:17:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<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/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=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[git]]></category>
		<category><![CDATA[Rails]]></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 two unmerged files [...]]]></description>
			<content:encoded><![CDATA[<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>
]]></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>

