<?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>git-clone &#8211; Accidents Happen</title>
	<atom:link href="https://ah.thameera.com/tag/git-clone/feed/" rel="self" type="application/rss+xml" />
	<link>https://ah.thameera.com</link>
	<description>In the dark</description>
	<lastBuildDate>Mon, 19 Nov 2012 15:36:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">56521109</site>	<item>
		<title>Keeping the Git directory and the working tree separate</title>
		<link>https://ah.thameera.com/keeping-the-git-directory-and-the-working-tree-separate/</link>
					<comments>https://ah.thameera.com/keeping-the-git-directory-and-the-working-tree-separate/#comments</comments>
		
		<dc:creator><![CDATA[thameera]]></dc:creator>
		<pubDate>Mon, 19 Nov 2012 15:36:46 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git-clone]]></category>
		<guid isPermaLink="false">http://noisythameera.wordpress.com/?p=255</guid>

					<description><![CDATA[When you clone/init a repo, the .git directory is created inside your working tree. This colleague of mine wanted to check-in the source code to a legacy versioning system other than git. Normally the .git directory gets pushed as well, since it&#8217;s inside the working tree. But he didn&#8217;t want to push the .git dir [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>When you clone/init a repo, the .git directory is created inside your working tree. This colleague of mine wanted to check-in the source code to a legacy versioning system other than git. Normally the .git directory gets pushed as well, since it&#8217;s <em>inside</em> the <a href="http://en.wikipedia.org/wiki/Git_(software)#Working_tree" target="_blank">working tree</a>. </p>
<div id="attachment_256" style="width: 180px" class="wp-caption aligncenter"><img decoding="async" aria-describedby="caption-attachment-256" src="http://ah.thameera.com/wp-content/uploads/2012/11/actual.jpg" alt="" title="actual" width="170" height="173" class="size-full wp-image-256" /><p id="caption-attachment-256" class="wp-caption-text">Normal structure</p></div>
<p>But he didn&#8217;t want to push the .git dir as well. He wanted something like this: </p>
<div id="attachment_257" style="width: 176px" class="wp-caption aligncenter"><img decoding="async" aria-describedby="caption-attachment-257" src="http://ah.thameera.com/wp-content/uploads/2012/11/requirement1.jpg" alt="" title="requirement" width="166" height="153" class="size-full wp-image-257" /><p id="caption-attachment-257" class="wp-caption-text">Required structure</p></div>
<p>If you look at the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-clone.html" target="_blank">git-clone man page</a>, there&#8217;s this option called <code>--separate-git-dir</code> which lets you assign a custom directory as the .git dir. The syntax is:</p>
<p><code>git clone git://path.to.repo newdir --separate-git-dir=somedir</code></p>
<p>But in this case, my colleague didn&#8217;t want to clone again. He had local branches galore and all. So I tried out the git-clone mentioned above and checked what really happens. It turns out that git creates a file called <em><code>.git</code></em> inside the working tree that looks like this:</p>
<blockquote><p>gitdir: /home/thameera/path/to/git/dir</p></blockquote>
<p>Gotcha! Now what we need to do is move my friend&#8217;s .git directory to a separate location and create a file called <code>.git</code> that has the path to the git dir as above. It works! </p>
]]></content:encoded>
					
					<wfw:commentRss>https://ah.thameera.com/keeping-the-git-directory-and-the-working-tree-separate/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">255</post-id>	</item>
	</channel>
</rss>
