<?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>searching for signal &#187; Aaron</title>
	<atom:link href="http://blog.n01se.net/?feed=rss2&#038;author=4" rel="self" type="application/rss+xml" />
	<link>http://blog.n01se.net</link>
	<description>theoretically unambiguous</description>
	<lastBuildDate>Sun, 29 Aug 2010 20:21:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>&#8220;git along little dogies&#8230;&#8221;</title>
		<link>http://blog.n01se.net/?p=179</link>
		<comments>http://blog.n01se.net/?p=179#comments</comments>
		<pubDate>Sat, 24 Apr 2010 03:02:37 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://blog.n01se.net/?p=179</guid>
		<description><![CDATA[At my place of work we're moving our repo management from gitosis to an evaluation installation of  GitHub:FI. After spending a while searching around for moving, backing up and transferring  git repos I was unable to find a good example. I had to dig through the git manpages for quite a while to figure out what [...]]]></description>
			<content:encoded><![CDATA[<p>At my place of work we're moving our repo management from <a title="gitosis" href="http://eagain.net/gitweb/?p=gitosis.git" target="_blank">gitosis</a> to an evaluation installation of  <a title="GitHub:FI" href="http://fi.github.com" target="_blank">GitHub:FI</a>. After spending a while searching around for moving, backing up and transferring  git repos I was unable to find a good example. I had to dig through the git manpages for quite a while to figure out what I wanted. The solution is quite simple but it was not obvious what combination of git clone/fetch/push/pull or other commands was appropriate. Now, this may be due to my own stupidity but even when I had the solution in hand I was still unable to find pages which showed how fully copy a repo from one remote location to a new remote location. I'm posting what I found here for posterity.</p>
<h3>Movin' right along...</h3>
<p>The basic process of moving a repo including all branches and tags is as follows:</p>
<blockquote>
<pre>git clone --mirror git@gitosis:my-repo.git
git --bare --git-dir my-repo.git push --mirror git@githubfi:my-user/my-repo.git</pre>
</blockquote>
<p>The above assumes that the <code>git@githubfi:my-user/my-repo.git</code> repo was created as an empty repo some point before the last command was run.</p>
<p>With the default config settings, <code>git clone</code> will create remote tracking branches for all branches found in the remote repo but will only create a local branch for the repository's currently active branch. In order to fully mirror the repository and all references (branches and tags) locally, you need to use the <code>--mirror</code> option which will also create the repo as a bare repository.</p>
<h3>Rawhide!</h3>
<p>A normal working copy has, at the top level, your checked out files and a <code>.git/</code> sub-directory. A bare repository omits the working copy and has the contents of the <code>.git/</code> directory at the top level. Bare repositories are intended to be used remotely (such as by a repository management system) and, by default, are named with a <code>.git</code> suffix to distinguish them as seen in the repo URLs above. (e.g. <code>my-repo.git</code>)</p>
<p>Since a bare repo has no working copy to sit in, we need to tell git where and how to find it when we call git commands against the repository, hence the <code>--bare --git-dir my-repo.git</code> options. The <code>git push --mirror</code> assures that all refs (branches/tags) will be pushed to the new location instead the default behaviors of only pushing refs (branches/tags) specified on the command line or pushing the branches that match by name between the local and remote repositories if none are specified on the command line.</p>
<h3>More cowbell...</h3>
<p>There's one further thing to mention that may be helpful. While transitioning from gitosis to GitHub:FI I took the opportunity to make our <code>pre-receive</code> hook a bit more stringent in its checking of emails, requiring that the committer email be from our corporate domain on non-upstream branches. In order to do this I had to use <code>git filter-branch</code> to do a little cleanup. Because we had a bare repo, the invocation looked a bit different. I'm showing a simplified version below:</p>
<blockquote>
<pre>git clone --mirror git@gitosis:my-repo.git
git --bare --git-dir my-repo.git filter-branch --commit-filter \
    '[ "$GIT_COMMITTER_EMAIL" = "joe@home.org"] &amp;&amp; export GIT_COMMITER_EMAIL="joe@work.com"; \
        git commit-tree "$@"' \
    -- master devel staging v2.{30..45}
git --bare --git-dir my-repo.git push --mirror git@githubfi:my-user/my-repo.git</pre>
</blockquote>
<p>Note that history rewriting such as done by <code>git filter-branch</code> has implications for any repos that have been cloned out in the wild. Be sure you understand history rewriting before you use this command or there will be pain and sadness among the other developers. In our case, the above changes were done in a manner that was coordinated among the developers involved and was quite pain free. Note also that I did not rewrite the "upstream" branch which did not need to be purged of non-work addresses so I omitted it from the list of refs to be filtered. Further note that tags, since they are refs, also need to be rewritten so I passed our version tags to <code>git filter-branch</code> as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.n01se.net/?feed=rss2&amp;p=179</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Placeholder post</title>
		<link>http://blog.n01se.net/?p=4</link>
		<comments>http://blog.n01se.net/?p=4#comments</comments>
		<pubDate>Sat, 20 May 2006 22:04:00 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.n01se.net/?p=4</guid>
		<description><![CDATA[Blogger requires me to make a post before I can preview the template or subscribe to the RSS feed. Is this fair enough or lame to the max? Discuss...]]></description>
			<content:encoded><![CDATA[<p>Blogger requires me to make a post before I can preview the template or subscribe to the RSS feed. Is this fair enough or lame to the max? Discuss...</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.n01se.net/?feed=rss2&amp;p=4</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.290 seconds -->
