<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>GitHub on Wimpy's World</title><link>https://blog.wimpys.world/tags/github/</link><description>Recent content in GitHub on Wimpy's World</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><managingEditor>martin@wimpress.com (Martin Wimpress)</managingEditor><webMaster>martin@wimpress.com (Martin Wimpress)</webMaster><lastBuildDate>Fri, 26 Oct 2012 16:39:00 +0000</lastBuildDate><atom:link href="https://blog.wimpys.world/tags/github/rss.xml" rel="self" type="application/rss+xml"/><item><title>GitHub Analytics</title><link>https://blog.wimpys.world/posts/github-analytics/</link><pubDate>Fri, 26 Oct 2012 16:39:00 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/github-analytics/</guid><description>&lt;p&gt;As I mentioned in a previous post we are prepairing to &lt;a href="2012-10-migrating-bzr-to-git.html"&gt;migrate our Bazaar
repositories to Git&lt;/a&gt;, or more
precisely to &lt;a href="https://github.com"&gt;GitHub&lt;/a&gt;. This migration also heralds the
Open Source releases of many of the core technologies we&amp;rsquo;ve been developing at
&lt;a href="http://www.flightdataservices.com"&gt;Flight Data Services&lt;/a&gt; for the last few years.&lt;/p&gt;
&lt;p&gt;I want to track visits for our GitHub projects. A bit of Googling turned up
&lt;a href="http://githalytics.com/"&gt;githalytics&lt;/a&gt; which enables you to track visits and
page views for your GitHub projects using
[http://www.google.com/analytics/](Google Analytics).&lt;/p&gt;
&lt;p&gt;To use it, create a new Google Analytics property ID for your GitHub project,
head over to &lt;a href="http://githalytics.com/"&gt;http://githalytics.com/&lt;/a&gt; and complete the web form. You&amp;rsquo;ll be
provided a &lt;a href="http://daringfireball.net/projects/markdown/"&gt;Markdown&lt;/a&gt; snippet to
insert in your projects &lt;code&gt;README.md&lt;/code&gt;. It will look something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[&lt;span class="nt"&gt;![githalytics.com alpha&lt;/span&gt;](&lt;span class="na"&gt;https://cruel-carlota.pagodabox.com/0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f &amp;#34;githalytics.com&amp;#34;&lt;/span&gt;)](http://githalytics.com/YourGitHubName/YourGitHubProject)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add the snippet to &lt;code&gt;README.md&lt;/code&gt; and push the changes. When someone visits your
GitHub project page, the visit will be tracked. Great!&lt;/p&gt;
&lt;p&gt;However, we write all our documentation using
&lt;a href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt;. But after a
quick Twitter and email exchange with Dimitrios from githalytics and I had
a reStructuredText snippet. It looks something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-rest" data-lang="rest"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;image:: https://cruel-carlota.pagodabox.com/0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; :alt: githalytics.com&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; :target: http://githalytics.com/YourGitHubName/YourGitHubProject&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Same drill, except add this snippet to &lt;code&gt;README.rst&lt;/code&gt; and push the changes.&lt;/p&gt;
&lt;p&gt;So there you have it, Google Analytics tracking of your GitHub project landing
page. If you have more than one project, create a Google Analytics property ID
and githalytics tracking snippet for each project.&lt;/p&gt;
&lt;h4 id="references"&gt;References&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://githalytics.com/"&gt;http://githalytics.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://githalytics.tumblr.com/"&gt;http://githalytics.tumblr.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://coderwall.com/team/githalytics"&gt;http://coderwall.com/team/githalytics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/4376560/add-google-analytics-to-github-wiki-pages"&gt;http://stackoverflow.com/questions/4376560/add-google-analytics-to-github-wiki-pages&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>How to add Google Analytics to GitHub projects.</summary></item><item><title>Migrating Bazaar to Git</title><link>https://blog.wimpys.world/posts/migrating-bazaar-to-git/</link><pubDate>Tue, 23 Oct 2012 11:50:00 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/migrating-bazaar-to-git/</guid><description>&lt;p&gt;We have been using &lt;a href="http://bazaar.canonical.com"&gt;Bazaar&lt;/a&gt; for source
control at &lt;a href="http://www.flightdataservices.com"&gt;work&lt;/a&gt; for nearly five
years. We are about to &lt;a href="http://opensource.org"&gt;Open Source&lt;/a&gt; most of our
core technologies and decided that &lt;a href="https://github.com"&gt;GitHub&lt;/a&gt; is the
best way to encourage community participation. We have signed up for a
Silver plan at GitHub and will migrate all our Bazaar repositories to Git.&lt;/p&gt;
&lt;p&gt;I have a few personal projects in Bazaar repositories hosted on
&lt;a href="http://www.launchpad.net"&gt;Launchpad&lt;/a&gt;. I decided to migrate my projects
to GitHub in order to learn the migration process. What follows is an
overview of how I did it using a fresh virtual machine running Ubuntu 10.04
LTS Server. I used a little project of mine called &lt;code&gt;nullserv&lt;/code&gt; in the
examples below.&lt;/p&gt;
&lt;p&gt;Add the Bazaar and Git PPAs.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install python-software-properties
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-add-repository ppa:bzr/ppa
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-add-repository ppa:git-core/ppa
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Install &lt;code&gt;bzr&lt;/code&gt; (and its requirements), &lt;code&gt;curl&lt;/code&gt; and &lt;code&gt;git&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install bzr bzr-fastimport curl git python-paramiko
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add the SSH keys and identify yourself.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bzr whoami &lt;span class="s2"&gt;&amp;#34;Your Name &amp;lt;name@example.org&amp;gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git config --global user.name &lt;span class="s2"&gt;&amp;#34;Your Name&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git config --global user.email you@example.org
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If your Bazaar repository is hosted on Launchpad assert your
identity.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bzr launchpad-login flexiondotorg
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Branch the Bazaar repository.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bzr branch lp:~flexiondotorg/+junk/nullserv
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; nullserv
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git init
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bzr fast-export --plain &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; git fast-import
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;This step is optional. It will delete and commit the deletions to the Bazaar repository.&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;for&lt;/span&gt; FILE in *&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; rm -rfv &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;FILE&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;This repository has been migrated to Git. https://github.com/flexiondotorg/nullserv&amp;#34;&lt;/span&gt; &amp;gt; README
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bzr add README
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bzr commit -m &lt;span class="s2"&gt;&amp;#34;This repository has been migrated to Git. https://github.com/flexiondotorg/nullserv&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bzr push :parent
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Remove the Bazaar repository and reset the Git repository.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rm -rf .bzr README
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git reset HEAD
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create &lt;code&gt;.gitattributes&lt;/code&gt; to normalise line endings.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &amp;gt;.gitattributes&lt;span class="s"&gt;&amp;lt;&amp;lt;ENDGITATTRIBS
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# Normalise line endings:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;* text=auto
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# Prevent certain files from being exported:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;.gitattributes export-ignore
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;.gitignore export-ignore
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;ENDGITATTRIBS&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add .gitattributes
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Migrate &lt;code&gt;.bzrignore&lt;/code&gt; to &lt;code&gt;.gitignore&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git mv .bzrignore .gitignore
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &amp;gt;&amp;gt; .gitignore
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;# Keep empty directories:&amp;#34;&lt;/span&gt; &amp;gt;&amp;gt; .gitignore
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;!*/.git*&amp;#34;&lt;/span&gt; &amp;gt;&amp;gt; .gitignore
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ensure empty directories are retained by git.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;find -empty -type d -not -iwholename &lt;span class="s1"&gt;&amp;#39;*.git*&amp;#39;&lt;/span&gt; -exec touch &lt;span class="s1"&gt;&amp;#39;{}/.gitkeep&amp;#39;&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add **/.gitkeep
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Commit the migrated repository&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git commit -a -m &lt;span class="s2"&gt;&amp;#34;Migrated from Bazaar to Git.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Thanks to Chris for pointing out &lt;code&gt;git filter-branch&lt;/code&gt; in the comments. If you
need to modify the author info in your repository history, you can do so with
this, just replace the names and email addresses accordingly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;BEWARE! This should not be performed on a repo that has been shared with others.
Use at your own risk.&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git filter-branch --commit-filter &lt;span class="s1"&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; if [ &amp;#34;$GIT_COMMITTER_NAME&amp;#34; = &amp;#34;Fred&amp;#34; ]; then
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_COMMITTER_NAME=&amp;#34;Fred Flintstone&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_AUTHOR_NAME=&amp;#34;Fred Flintstone&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_COMMITTER_EMAIL=&amp;#34;fred@example.org&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_AUTHOR_EMAIL=&amp;#34;fred@example.org&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; git commit-tree &amp;#34;$@&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; elif [ &amp;#34;$GIT_COMMITTER_NAME&amp;#34; = &amp;#34;Barney&amp;#34; ]; then
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_COMMITTER_NAME=&amp;#34;Barney Rubble&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_AUTHOR_NAME=&amp;#34;Barney Rubble&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_COMMITTER_EMAIL=&amp;#34;barney@example.org&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_AUTHOR_EMAIL=&amp;#34;barney@example.org&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; git commit-tree &amp;#34;$@&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; else
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; git commit-tree &amp;#34;$@&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; fi&amp;#39;&lt;/span&gt; HEAD
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you want to delete any files from the commit history, you can optionally do that now.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git filter-branch -f --index-filter &lt;span class="s2"&gt;&amp;#34;git rm --cached --ignore-unmatch *.THIS *.THAT&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--prune-empty --tag-name-filter cat -- --all
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rm -rf .git/refs/original/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git reflog expire --expire&lt;span class="o"&gt;=&lt;/span&gt;now --all
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git gc --prune&lt;span class="o"&gt;=&lt;/span&gt;now
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Resume here, regardless of whether you deleted any files from the commit history or not.
Remove everything from the index.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git rm --cached -r .
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Write both the index and working directory from git&amp;rsquo;s database.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git reset --hard
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Prepare to make a commit by staging all the files that will get normalized.
This is your chance to inspect which files were never normalized. You may
get lots of messages like: &lt;code&gt;warning: CRLF will be replaced by LF in file.&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add .
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git commit -m &lt;span class="s2"&gt;&amp;#34;Forced line endings to eol=lf&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Aggressively pack the repository.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git gc --aggressive --prune&lt;span class="o"&gt;=&lt;/span&gt;now
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point you have a migrated git repository. You can poke about a check that
everything is present and correct.&lt;/p&gt;
&lt;p&gt;Optionally you can create a new GitHub repository using their API. Replace &lt;code&gt;USER&lt;/code&gt;
and &lt;code&gt;PASS&lt;/code&gt; with your GitHub login crednetials.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -u &lt;span class="s1"&gt;&amp;#39;USER:PASS&amp;#39;&lt;/span&gt; https://api.github.com/user/repos -d &lt;span class="s1"&gt;&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;nullserv&amp;#34;}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you want to create repositories for an Organisation the following will
work. Replace &lt;code&gt;YourOrganisation&lt;/code&gt; with the organisation name your are a
member of.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -u &lt;span class="s1"&gt;&amp;#39;USER:PASS&amp;#39;&lt;/span&gt; https://api.github.com/orgs/YourOrganisation/repos -d &lt;span class="s1"&gt;&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;nullserv&amp;#34;}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Private repositories can be created, providing you have a paid GitHub account,
by changing the &lt;code&gt;POST&lt;/code&gt; data as follows.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;nullserv&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;private&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Lastly, push to the newly created GitHub repo.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git remote add origin git@github.com:flexiondotorg/nullserv.git
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git push -u origin master
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;All done, the Bazaar repository has been crippled and the Git repository is
ready for use on GitHub.&lt;/p&gt;
&lt;h4 id="references"&gt;References&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/624941"&gt;https://gist.github.com/624941&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/2423777/is-it-possible-to-create-a-remote-repo-on-github-from-the-cli-without-ssh"&gt;http://stackoverflow.com/questions/2423777/is-it-possible-to-create-a-remote-repo-on-github-from-the-cli-without-ssh&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/750172/how-do-i-change-the-author-of-a-commit-in-git"&gt;http://stackoverflow.com/questions/750172/how-do-i-change-the-author-of-a-commit-in-git&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://help.github.com/articles/changing-author-info"&gt;https://help.github.com/articles/changing-author-info&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.github.com/v3/repos/"&gt;http://developer.github.com/v3/repos/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://help.github.com/articles/dealing-with-line-endings#platform-all"&gt;https://help.github.com/articles/dealing-with-line-endings#platform-all&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>A rough guide to migrating Bazaar repositories to GitHub</summary></item></channel></rss>