<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Git on Wimpy's World</title><link>https://blog.wimpys.world/tags/git/</link><description>Recent content in Git 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>Thu, 05 Jun 2025 13:37:42 +0100</lastBuildDate><atom:link href="https://blog.wimpys.world/tags/git/rss.xml" rel="self" type="application/rss+xml"/><item><title>faffing about with diffs</title><link>https://blog.wimpys.world/posts/faff-ollama-conventional-commit-generator/</link><pubDate>Thu, 05 Jun 2025 13:37:42 +0100</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/faff-ollama-conventional-commit-generator/</guid><description>&lt;p&gt;Picture this: you&amp;rsquo;ve just spent literal minutes crafting the perfect bit of code, you&amp;rsquo;re chuffed with yourself, and then you open your git client only to stare at that commit message box. 🤔&lt;/p&gt;
&lt;p&gt;That cursor blinking mockingly while you try to remember what you changed just moments ago. &lt;strong&gt;And you wonder, why do I have to write this? &lt;code&gt;git&lt;/code&gt; already knows what happened!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Now, I&amp;rsquo;m a proper &lt;a href="https://gitkraken.dev/"&gt;GitKraken&lt;/a&gt; devotee – have been for years 🦑 Love the thing so much I&amp;rsquo;ve disabled all git integrations in VS Code to maintain a clean separation between coding and source control. It&amp;rsquo;s brilliant software and I&amp;rsquo;m happy to pay for it (&lt;a href="https://gitkraken.cello.so/AxtLstzXaif"&gt;you should too using my handy-dandy referral link&lt;/a&gt;) 🤑&lt;/p&gt;
&lt;h2 id="when-ai-promises-go-sideways"&gt;When AI promises go sideways&lt;/h2&gt;
&lt;p&gt;GitKraken recently added AI integration for generating commit messages, complete with customisable prompts. Naturally, I thought &lt;em&gt;&amp;ldquo;Right, this&amp;rsquo;ll sort my commit message faff once and for all!&amp;rdquo;&lt;/em&gt; Two problems emerged rather quickly:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;First, I blew through my AI credit bundle faster than a student with their first overdraft facility. Turns out I commit quite a lot, and those credits don&amp;rsquo;t stretch as far as you&amp;rsquo;d hope.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Second, and this really wound me up, I could not for the life of me get it to generate proper &lt;a href="https://www.conventionalcommits.org/"&gt;Conventional Commits&lt;/a&gt;. I know how to craft AI system prompts – I&amp;rsquo;ve been mucking about with LLMs long enough – but GitKraken&amp;rsquo;s AI seemed determined to ignore my carefully crafted instructions about &lt;code&gt;feat:&lt;/code&gt;, &lt;code&gt;fix:&lt;/code&gt;, and &lt;code&gt;chore:&lt;/code&gt; prefixes.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="enter-faff-stage-left"&gt;Enter faff, stage left&lt;/h2&gt;
&lt;p&gt;So naturally, being the sort of person who builds entire projects out of mild irritation, I decided to solve this myself. Meet &lt;a href="https://github.com/wimpysworld/faff"&gt;&lt;code&gt;faff&lt;/code&gt;&lt;/a&gt; – yet another bloody AI commit generator, because apparently the Internet wasn&amp;rsquo;t drowning in enough of them already ☔&lt;/p&gt;
&lt;p&gt;&lt;code&gt;faff&lt;/code&gt; does one thing: it looks at your staged git diff, sends it to a local &lt;a href="https://ollama.com/"&gt;Ollama&lt;/a&gt; LLM, and spits out a conventional commit message. No cloud APIs, no credit bundles, no sending your &lt;code&gt;TODO: delete this abomination&lt;/code&gt; code comments to feed the vibe-coding dealers.&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;faff
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Perfect conventional commits, every time. Well, most of the time. It&amp;rsquo;s AI, not magic 🪄&lt;/p&gt;
&lt;div align="center"&gt;&lt;img alt="faff demo" src="faff.gif" width="1024" /&gt;&lt;/div&gt;
&lt;h2 id="the-plot-twist-that-made-me-question-everything"&gt;The plot twist that made me question everything&lt;/h2&gt;
&lt;p&gt;Here&amp;rsquo;s where this story takes a turn that&amp;rsquo;ll make you laugh at my expense. After building &lt;code&gt;faff&lt;/code&gt;, documenting it, and feeling rather pleased with myself, I discovered something that made me want to bang my head against my desk repeatedly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;You can hook GitKraken&amp;rsquo;s AI up to Ollama.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;And naturally, &lt;a href="https://github.com/wimpysworld/faff/blob/main/faff.sh#L8"&gt;my carefully crafted system prompt from &lt;code&gt;faff&lt;/code&gt;&lt;/a&gt;, when used in GitKraken AI via Ollama with the same &lt;a href="https://ollama.com/library/qwen2.5-coder"&gt;qwen2.5-coder&lt;/a&gt; models, works exactly like &lt;code&gt;faff&lt;/code&gt; does. 🤦‍♂️&lt;/p&gt;
&lt;p&gt;So technically, I could have solved my original problem without building an new tool. But where&amp;rsquo;s the fun in that?&lt;/p&gt;
&lt;h2 id="why-faff-still-matters-and-its-not-just-stubbornness"&gt;Why faff still matters (and it&amp;rsquo;s not just stubbornness)&lt;/h2&gt;
&lt;p&gt;Despite this rather embarrassing revelation, &lt;code&gt;faff&lt;/code&gt; still has its place:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Privacy by default&lt;/strong&gt;: Everything stays local, until you push it to GitHub&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No vendor lock-in&lt;/strong&gt;: Works with any Ollama-supported model. Want to try the latest coding model? Just change the environment variable.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Shell-first design&lt;/strong&gt;: Perfect for those of us who live in terminals, or an excuse for me creating another shonky shell script&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Learning project&lt;/strong&gt;: Born from genuine frustration and a desire to poke around the &lt;a href="https://github.com/ollama/ollama/blob/main/docs/api.md"&gt;Ollama API&lt;/a&gt;. Sometimes the best tools come from scratching your own itch.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Plus, let&amp;rsquo;s be honest – there&amp;rsquo;s something deeply satisfying about having a tool that does exactly what you want, how you want it, without any &lt;em&gt;faff!&lt;/em&gt; 🥁&lt;/p&gt;
&lt;h2 id="give-it-a-whirl"&gt;Give it a whirl&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re tired of crafting commit messages that either say &amp;ldquo;Updated stuff&amp;rdquo; (&lt;em&gt;again!&lt;/em&gt;) or read like Victorian novels, &lt;a href="https://github.com/wimpysworld/faff"&gt;&lt;code&gt;faff&lt;/code&gt; might be worth a look&lt;/a&gt;. It&amp;rsquo;s a shell script, it works with local AI, and it follows conventional commits standards without the existential crisis.&lt;/p&gt;
&lt;p&gt;And if you decide you&amp;rsquo;d rather stick with GitKraken&amp;rsquo;s AI (which, after my discoveries, is perfectly reasonable), at least &lt;a href="https://gitkraken.cello.so/AxtLstzXaif"&gt;grab it through my referral link&lt;/a&gt; so I can pretend this whole adventure was planned from the start. ️🗺️&lt;/p&gt;
&lt;p&gt;Because sometimes the best projects are the ones born from pure spite, accidentally becoming useful along the way. That&amp;rsquo;s half the fun of building things, isn&amp;rsquo;t it?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Drop the faff, dodge the judgment, get back to coding. 🦙&lt;/strong&gt;&lt;/p&gt;</description><summary>Another bloody AI commit generator, born from pure spite but stays local</summary></item><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>