<?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>Joe Maller &#187; git</title>
	<atom:link href="http://joemaller.com/tag/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://joemaller.com</link>
	<description>.com</description>
	<lastBuildDate>Tue, 15 May 2012 03:40:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Faster and easier Gitweb installation</title>
		<link>http://joemaller.com/1596/faster-easier-gitweb-installation/</link>
		<comments>http://joemaller.com/1596/faster-easier-gitweb-installation/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 22:47:20 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[misc.]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[gitweb]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://joemaller.com/?p=1596</guid>
		<description><![CDATA[The idea of using make to build Gitweb isn&#8217;t just excessively complex, it&#8217;s also mostly unnecessary. Building gitweb.cgi from gitweb.perl only changes 19 of the source file&#8217;s 6734 lines (0.2%). Fact is, to get Gitweb working only one line needs changing. After the following edit, all local configuration values can be loaded from a simple [...]]]></description>
			<content:encoded><![CDATA[<p>The idea of using make to build <a href="http://git.or.cz/gitwiki/Gitweb">Gitweb</a> isn&#8217;t just excessively complex, it&#8217;s also mostly unnecessary. Building <strong>gitweb.cgi</strong> from <strong>gitweb.perl</strong> only changes 19 of the source file&#8217;s 6734 lines (0.2%).</p>
<p>Fact is, to get Gitweb working only <em>one</em> line needs changing. After the following edit, all local configuration values can be loaded from a simple config file.</p>
<p>On line 546, insert the name of your config file:</p>
<pre><code><span style="color: red">-our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";</span>
+our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "<strong>gitweb_config.perl</strong>";</code></pre>
<p>A set of fully-documented configuration files is available in the <a href="http://github.com/joemaller/Simple-Gitweb-Config">Simple Gitweb Config</a> project on Github, to help get things up and running quickly.</p>
<p><span id="more-1596"></span></p>
<h3>Full instructions</h3>
<p>Here are all the steps necessary to get Gitweb running on a webserver. In most cases, the configuration will work without modification, installation shouldn&#8217;t take more than five minutes start to finish.</p>
<ol>
<li>Create temporary source directory:</li>
<pre><code>mkdir ~/src &amp;&amp; cd ~/src</code></pre>
<li>Download and extract Git source and Simple Gitweb Config tarballs:</li>
<pre><code>curl -LO http://kernel.org/pub/software/scm/git/git-1.6.6.tar.gz
curl -LO http://github.com/joemaller/Simple-Gitweb-Config/tarball/master
tar -xvzf git-1.6.6.tar.gz
tar -xzvf master</code></pre>
<li>Copy Git&#8217;s gitweb subdirectory to a web accessible location, then copy the gitweb config files into the live gitweb directory:</li>
<pre><code>cp -r git-1.6.6/gitweb ~/www/
cp joemaller-Simple-Gitweb-Config*/* ~/www/gitweb/</code></pre>
<li>Replace <code>++GITWEB_CONFIG++</code> with <code>gitweb_config.perl</code> and make the resulting CGI executable:</li>
<pre><code>sed -re's/\++GITWEB_CONFIG\++/gitweb_config.perl/g' gitweb.perl  &gt; gitweb.cgi
chmod a+x gitweb.cgi</code></pre>
<li>Gitweb should be working now, but if necessary, edit <strong>projects_list.txt</strong>, <strong>gitweb_config.perl</strong> and customize the three html files for your environment. </li>
</ol>
<p>One last note, since it wasn&#8217;t immediately obvious to me. To change the default repository description, <em>&#8220;Unnamed repository; edit this file to name it for gitweb.&#8221;</em> edit the configuration file inside the .git folder. Descriptions are per-repository and do not update or transfer with pushes, pulls or clones.</p>
]]></content:encoded>
			<wfw:commentRss>http://joemaller.com/1596/faster-easier-gitweb-installation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Convert Git branches to remote tracking branches</title>
		<link>http://joemaller.com/1523/convert-git-branches-to-remote-tracking-branches/</link>
		<comments>http://joemaller.com/1523/convert-git-branches-to-remote-tracking-branches/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 18:19:29 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[misc.]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://joemaller.com/?p=1523</guid>
		<description><![CDATA[There are two ways to convert an existing branch to a remote tracking branch, using git config or directly editing the .git/config file. In both of these examples, the local and remote branches are named &#8220;master&#8221;. The remote repository is &#8220;hub&#8221;. git config commands git config branch.master.remote hub git config branch.master.merge refs/heads/master editing .git/config All [...]]]></description>
			<content:encoded><![CDATA[<p>There are two ways to convert an existing branch to a remote tracking branch, using <code>git config</code> or directly editing the <strong>.git/config</strong> file.</p>
<p>In both of these examples, the local and remote branches are named &#8220;master&#8221;. The remote repository is &#8220;hub&#8221;.</p>
<h3>git config commands</h3>
<pre><code>git config branch.master.remote hub
git config branch.master.merge refs/heads/master</code></pre>
<h3>editing .git/config</h3>
<p>All the <code>git config</code> commands do is add the following to <strong>.git/config</strong>, editing the file manually has the same result.</p>
<pre><code>[branch "master"]
	remote = hub
	merge = refs/heads/master</code></pre>
<p>What would be nice is an additional config command, branch.&lt;name&gt;.track, which would split a full refspec, sending the relevant parts to the remote and merge commands.</p>
]]></content:encoded>
			<wfw:commentRss>http://joemaller.com/1523/convert-git-branches-to-remote-tracking-branches/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git error: index file is too small</title>
		<link>http://joemaller.com/1283/git-error-index-file-is-too-small/</link>
		<comments>http://joemaller.com/1283/git-error-index-file-is-too-small/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 07:17:56 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[misc.]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://joemaller.com/?p=1283</guid>
		<description><![CDATA[This error popped up recently while trying to mirror a git repository onto another server. Attempting to clone the repository yielded hundreds of errors like these two: ./objects/pack/._pack-de7d2e641423ddac38ff369dae6afad9f02d4397.idx is too small error: index file /home/joe/site/.git/objects/pack/._pack-de7d2e641423ddac38ff369dae6afad9f02d4397.idx is too small Not a lot has been written about this error, and I don&#8217;t make any claims to understanding [...]]]></description>
			<content:encoded><![CDATA[<p>This error popped up recently while trying to mirror a git repository onto another server. Attempting to clone the repository yielded hundreds of errors like these two:</p>
<p><code>./objects/pack/._pack-de7d2e641423ddac38ff369dae6afad9f02d4397.idx is too small<br />
error: index file /home/joe/site/.git/objects/pack/._pack-de7d2e641423ddac38ff369dae6afad9f02d4397.idx is too small</code></p>
<p>Not a lot has been written about this error, and I don&#8217;t make any claims to understanding Git&#8217;s internals enough to know whether or not that was a very bad thing or just cosmetic. But playing it safe, I assumed the clone had failed and the repository was compromised. </p>
<p>On my machines, I&#8217;m running up to date 1.6.x Git binaries, but the server throwing these errors is running 1.5.4.1. I suspected a version imcompatibility, but googling for &#8220;git&#8221; and any variant of &#8220;version&#8221; is epic futility. (hint, google &#8220;backwards compatible&#8221; instead). Here&#8217;s what I found:</p>
<p>Sometime around version 1.5.0, <a href="http://www.kernel.org/pub/software/scm/git/docs/RelNotes-1.5.0.txt">Git&#8217;s repository format changed</a>. While the notes indicated  the server version of Git should have supported this, a <a href="http://lists.zerezo.com/git/msg658577.html">Git development patch</a> and the <a href="http://www.kernel.org/pub/software/scm/git/docs/RelNotes-1.6.0.txt">Git 1.6.0 release notes</a> convinced me to try:</p>
<blockquote><p><strong>By default, packfiles created with this version uses delta-base-offset<br />
encoding</strong> introduced in v1.4.4.  Pack idx files are using version 2 that<br />
allows larger packs and added robustness thanks to its CRC checking,<br />
introduced in v1.5.2 and v1.4.4.5.  <strong>If you want to keep your repositories<br />
backwards compatible past these versions, set repack.useDeltaBaseOffset<br />
to false</strong> or pack.indexVersion to 1, respectively.</p></blockquote>
<p>In the local repository&#8217;s config, I set repack.usedeltabaseoffset to false and then repacked the repository: </p>
<p><code>git config repack.usedeltabaseoffset false<br />
git repack -a -d</code></p>
<p>This appears to have fixed the problem. Cloning the repository worked perfectly and everything seems to be working smoothly now.</p>
]]></content:encoded>
			<wfw:commentRss>http://joemaller.com/1283/git-error-index-file-is-too-small/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A web-focused Git workflow</title>
		<link>http://joemaller.com/990/a-web-focused-git-workflow/</link>
		<comments>http://joemaller.com/990/a-web-focused-git-workflow/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 17:04:30 +0000</pubDate>
		<dc:creator>Joe Maller</dc:creator>
				<category><![CDATA[misc.]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://joemaller.com/?p=990</guid>
		<description><![CDATA[After months of looking, struggling through Git-SVN glitches and letting things roll around in my head, I&#8217;ve finally arrived at a web-focused Git workflow that&#8217;s simple, flexible and easy to use. Some key advantages: Pushing remote changes automatically updates the live site Server-based site edits won&#8217;t break history Simple, no special commit rules or requirements [...]]]></description>
			<content:encoded><![CDATA[<p>After months of looking, struggling through Git-SVN glitches and letting things roll around in my head, I&#8217;ve finally arrived at a web-focused Git workflow that&#8217;s simple, flexible and easy to use.</p>
<p>Some key advantages:</p>
<ul>
<li>Pushing remote changes automatically updates the live site</li>
<li>Server-based site edits won&#8217;t break history</li>
<li>Simple, no special commit rules or requirements</li>
<li>Works with existing sites, no need to redeploy or move files</li>
</ul>
<h3>Overview</h3>
<p>The key idea in this system is that the web site exists on the server as a pair of repositories; a bare repository alongside a conventional repository containing the live site. Two simple Git hooks link the pair, automatically pushing and pulling changes between them.</p>
<p><img src="http://joemaller.com/wordpress/wp-content/uploads/2008/11/hub-prime2.jpg" alt="" title="hub, prime, clones" width="500" height="247" /></p>
<p>The two repositories:</p>
<ul>
<li><strong>Hub</strong> is a bare repository. All other repositories will be cloned from this.</li>
<li><strong>Prime</strong> is a standard repository, the live web site is served from its working directory.</li>
</ul>
<p>Using the pair of repositories is simple and flexible. Remote clones with ssh-access can update the live site with a simple <strong>git push </strong>to Hub. Any files edited directly on the server are instantly mirrored into Hub upon commit. The whole thing pretty much just works &#8212; whichever way it&#8217;s used.</p>
<p><strong>Getting ready</strong></p>
<p>Obviously <a href="http://git.or.cz/">Git</a> is required on the server and any local machines. My shared web host doesn&#8217;t offer Git, but it&#8217;s easy enough to <a href="http://joemaller.com/2008/08/13/how-to-install-git-on-a-shared-host/">install Git yourself</a>.</p>
<p>If this is the first time running Git on your webserver, remember to <a href="http://rails.wincent.com/wiki/Git_quickstart ">setup your global configuration info</a>. I set a different Git user.name to help distinguish server-based changes in project history.</p>
<pre><code>$ git config --global user.name "Joe, working on the server"</code></pre>
<h3>Getting started</h3>
<p>The first step is to initialize a new Git repository in the live web site directory on the server, then to add and commit all the site&#8217;s files. This is the <strong>Prime</strong> repository and working copy. Even if history exists in other places, the contents of the live site will be the baseline onto which all other work is merged.</p>
<pre><code>$ cd ~/www
$ git init
$ git add .
$ git commit -m"initial import of pre-existing web files"</code></pre>
<p>Initializing in place also means there is no downtime or need to re-deploy the site, Git just builds a repository around everything that&#8217;s  already there.</p>
<p>With the live site now safely in Git, create a bare repository outside the web directory, this is <strong>Hub</strong>.</p>
<pre><code>$ cd; mkdir site_hub.git; cd site_hub.git
$ git --bare init
<span class="response">Initialized empty Git repository in /home/joe/site_hub.git</span></code></pre>
<p>Then, from inside Prime&#8217;s working directory, add Hub as a remote and push Prime&#8217;s master branch:</p>
<pre><code>$ cd ~/www
$ git remote add hub ~/site_hub.git
$ git remote show hub
<span class="response">* remote hub
  URL: /home/joe/site_hub.git</span>
$ git push hub master</code></pre>
<h3>Hooks</h3>
<p>Two simple Git hooks scripts keep Hub and Prime linked together.</p>
<p>An oft-repeated rule of Git is to <a href="http://git.or.cz/gitwiki/GitFaq#head-b96f48bc9c925074be9f95c0fce69bcece5f6e73">never push into a repository that has a work tree attached to it</a>. I tried it, and things do get weird fast. The hub repository exists for this reason. Instead of pushing changes to Prime from Hub, which wouldn&#8217;t affect the working copy anyway, Hub uses a hook script which tells Prime to pull changes from Hub.</p>
<h4>post-update &#8211; Hub repository</h4>
<p>This hook is called when Hub receives an update. The script changes directories to the Prime repository working copy then runs a pull from Prime. Pushing changes doesn&#8217;t update a repository&#8217;s working copy, so it&#8217;s necessary to execute this from inside the working copy itself.</p>
<pre><code>#!/bin/sh

echo
echo "**** Pulling changes into Prime [Hub's post-update hook]"
echo

cd $HOME/www || exit
unset GIT_DIR
git pull hub master

exec git-update-server-info</code></pre>
<h4>post-commit &#8211; Prime repository</h4>
<p>This hook is called after every commit to send the newly commited changes back up to Hub. Ideally, it&#8217;s not common to make changes live on the server, but automating this makes sure site history won&#8217;t diverge and create conflicts.</p>
<pre><code>#!/bin/sh

echo
echo "**** pushing changes to Hub [Prime's post-commit hook]"
echo

git push hub</code></pre>
<p>With this hook in place, all changes made to Prime&#8217;s master branch are immediately available from Hub. Other branches will also be cloned, but won&#8217;t affect the site. Because all remote repository access is via SSH urls, only users with shell access to the web server will be able to push and trigger a site update.</p>
<h3>Conflicts</h3>
<p>This repository-hook arrangement makes it very difficult to accidentally break the live site. Since every commit to Prime is automatically pushed to Hub, all conflicts will be immediately visible to the clones when pushing an update. </p>
<p>However there are a few situations where Prime can diverge from Hub which will require additional steps to fix. If an uncommitted edit leaves Prime in a dirty state, Hub&#8217;s post-update pull will fail with an &#8220;Entry &#8216;foo&#8217; not uptodate. Cannot merge.&#8221; warning. Committing changes will clean up Prime&#8217;s working directory, and the post-update hook will then merge the un-pulled changes. </p>
<p>If a conflict occurs where changes to Prime can&#8217;t be merged with Hub, I&#8217;ve found the best solution is to push the current state of Prime to a new branch on Hub. The following command, issued from inside Prime, will create a remote &#8220;fixme&#8221; branch based on the current contents of Prime:</p>
<pre><code>$ git push hub master:refs/heads/fixme</code></pre>
<p>Once that&#8217;s in Hub, any remote clone can pull down the new branch and resolve the merge. Trying to resolve a conflict on the server would almost certainly break the site due to Git&#8217;s conflict markers.</p>
<h3>Housekeeping</h3>
<p>Prime&#8217;s .git folder is at the root level of the web site, and is probably publicly accessible. To protect the folder and prevent unwanted clones of the repository, add the following to your top-level .htaccess file to forbid web access:</p>
<pre><code># deny access to the top-level git repository:
RewriteEngine On
RewriteRule \.git - [F,L]</code></pre>
<h3>Troubleshooting</h3>
<p>If you&#8217;re seeing this error when trying to push to a server repository:
<pre><code><span class="response nocode">git-receive-pack: command not found
fatal: The remote end hung up unexpectedly</span></code></pre>
<p>Add <code>export PATH=${PATH}:~/bin</code> to your .bashrc file on the server. Thanks to Robert for <a href="http://www.bluestatic.org/blog/2007/08/01/git-public-push-ing/">finding and posting the fix</a>.</p>
<h3>Links</h3>
<p>These didn&#8217;t fit in anywhere else:</p>
<ul>
<li>Toolman Tim has a very good introductory walkthrough of <a href="http://toolmantim.com/article/2007/12/5/setting_up_a_new_remote_git_repository">setting up a new remote git repository</a>.
</li>
<li>This ended up being somewhat similar to the <a href="http://ikiwiki.info/rcs/git/"> update mechanism in Ikiwiki</a>, wish I&#8217;d found that page earlier.</li>
<li><a href="http://www.linuxworld.com/community/?q=node/3057"> Getting a static web site organized with git </a> came up with a different solution, but calling <code>git reset --hard</code> from a hook on the server could cause a lot of trouble when committing server-side changes.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://joemaller.com/990/a-web-focused-git-workflow/feed/</wfw:commentRss>
		<slash:comments>89</slash:comments>
		</item>
		<item>
		<title>How to install Git on a shared host</title>
		<link>http://joemaller.com/908/how-to-install-git-on-a-shared-host/</link>
		<comments>http://joemaller.com/908/how-to-install-git-on-a-shared-host/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 01:45:00 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[shared host]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://joemaller.com/?p=908</guid>
		<description><![CDATA[(regularly updated) Installing Git on a shared hosting account is simple, the installation is fast and like most things Git, it just works. This is a basic install without documentation. My main goal is to be able to push changes from remote repositories into the hosted repository, which also serves as the source directory of [...]]]></description>
			<content:encoded><![CDATA[<p><em>(regularly updated)</em></p>
<p>Installing <a href="http://git-scm.com">Git</a> on a shared hosting account is simple, the installation is fast and like most things Git, it just works.</p>
<p>This is a basic install without documentation. My main goal is to be able to push changes from remote repositories into the hosted repository, which also serves as the source directory of the live website. <a href="http://joemaller.com/990/a-web-focused-git-workflow/">Like this</a>.</p>
<h3>Prerequisites</h3>
<p>The only two things you absolutely must have are shell access to the account and permission to use GCC on the server. Check both with the following command:</p>
<pre><code>$ ssh joe@webserver 'gcc --version'
<span class="output">gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
[...]</span></code></pre>
<p>If GCC replies with a version number, you should be able to install Git. SSH into your server and let&#8217;s get started!</p>
<p>If you see something like <em>/usr/bin/gcc: Permission denied</em> you don&#8217;t have access to the GCC compiler and <strong>will not</strong> be able to build the Git binaries from source. <a href="#hosting">Find another hosting company</a>.</p>
<h3>Update your $PATH</h3>
<p>None of this will work if you don&#8217;t update the $PATH environment variable. In most cases, this is set in <strong>.bashrc</strong>. Using <strong>.bashrc</strong> instead of <strong>.bash_profile</strong> updates $PATH for interactive and non-interactive sessions&#8211;which is necessary for remote Git commands. Edit <strong>.bashrc</strong> and add the following line:</p>
<pre><code>export PATH=$HOME/bin:$PATH</code></pre>
<p>Be sure &#8216;~/bin&#8217; is at the beginning since $PATH is searched from left to right; to execute local binaries first, their location has to appear first. Depending on your server&#8217;s configuration there could be a lot of other stuff in there, including duplicates.</p>
<p>Double-check this by sourcing the file and echoing $PATH:</p>
<pre><code>$ source ~/.bashrc
$ echo $PATH
<span class="output">/home/joe/bin:/usr/local/bin:/bin:/usr/bin</span></code></pre>
<p>Verify that the remote path was updated by sending a remote command like this (from another connection):</p>
<pre><code>$ ssh joe@webserver 'echo $PATH'
<span class="output">/home/joe/bin:/usr/local/bin:/bin:/usr/bin</span></code></pre>
<p>Note: Previous iterations of this page installed into the ~/opt directory. Following current Git conventions, I&#8217;m now installing into the default <code>~/bin</code>.</p>
<h3>Installing Git</h3>
<p>SSH into your webserver. I created a source directory to hold the files and make cleanup easier:</p>
<pre><code>$ cd
$ mkdir src
$ cd src</code></pre>
<p>Grab the most recent source tarball from <a href="https://github.com/git/git/tags/">Github</a>. When this post was updated, the current Git release was version 1.7.10.1:</p>
<pre><code>$ curl -LO https://github.com/git/git/tarball/v1.7.10.1</code></pre>
<p>Untar the archive and cd into the new directory:</p>
<pre><code>$ tar -xzvf v1.7.10.1
$ cd git-git-9dfad1a</code></pre>
<p>By default, Git installs into <code>~/bin</code> which is perfect for shared hosting. Earlier versions required adding a prefix to the configure script (<a href="http://joemaller.com/881/how-to-install-subversion-on-a-shared-host/">like this</a>), but none of that is necessary anymore. If you do need to change the install location of Git, just specify a prefix to the Make command as described in Git&#8217;s INSTALL file.</p>
<p>With all that taken care of, installation is simple:</p>
<pre><code>$ make
$ make install
<span class="response">[lots of words...]</span></code></pre>
<p></code></pre>
<p>That should be it, check your installed version like this:</p>
<pre><code>$ git --version
<span class="response">git version 1.7.10.1</span></code></pre>
<p>It's now safe to delete the src folder containing the downloaded tarball and source files.</p>
<p><a name="hosting"></a>My preferred shared hosting providers are <a href="http://www.a2hosting.com/1482.html">A2 Hosting</a> and <a href="http://www.webfaction.com/signup?affiliate=joemaller">WebFaction</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://joemaller.com/908/how-to-install-git-on-a-shared-host/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Switching to Git</title>
		<link>http://joemaller.com/907/switching-to-git/</link>
		<comments>http://joemaller.com/907/switching-to-git/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 04:35:52 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[misc.]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://joemaller.com/?p=907</guid>
		<description><![CDATA[I resisted Git for a long time. It seemed a cultish thing with devout vocal followers and frequent mentions on Digg. I figured it would probably be a passing fad. I was wrong. I drank the Kool-Aid and damn, it was tasty. The first important thing to realize, especially when starting out and considering switching, [...]]]></description>
			<content:encoded><![CDATA[<p>I resisted Git for a long time. It seemed a cultish thing with devout vocal followers and frequent mentions on Digg. I figured it would probably be a passing fad. I was wrong.</p>
<p>I drank the Kool-Aid and damn, it was tasty.</p>
<p>The first important thing to realize, especially when starting out and considering switching, is that <strong>Git works with existing Subversion repositories</strong>. That means the transition can be as simple as learning a few new commands, your repositories and servers don&#8217;t need to changing. Other team members don&#8217;t need to switch. If I had any other team members, this would be huge. </p>
<p>Of course, once you start using Git and see its potential, you&#8217;ll probably switch everything, convert your repositories and feel superior whenever you have to work with a Subversion hosted project.</p>
<p>Ultimately, Git is a revision control system and is fundamentally about preserving and protecting your working history. So feel free to experiment, it&#8217;s really hard to mess up.</p>
<p>It took me an afternoon to grasp the basic concepts of Git, or at least enough to use it in dumb-SVN mode. After about a week, I started to feel fairly comfortable.</p>
<p>I read a small mountain of weblog posts, documentation and the like, here are the ones I found most valuable:</p>
<ul>
<li><a href='http://cworth.org/hgbook-git/tour/'>A tour of git: the basics</a><br />
Carl Worth&#8217;s port of Bryan O&#8217;Sullivan&#8217;s Mercurial book</li>
<li><a href='http://tsunanet.blogspot.com/2007/07/learning-git-svn-in-5min.html'>Learning git-svn in 5min</a></li>
<li><a href='http://maymay.net/blog/2008/03/26/howto-use-git-for-personal-development-when-everyone-else-is-using-subversion-part-1/'>HowTo: Use git for personal development when everyone else is using Subversion Part 1</a> and <a href='http://maymay.net/blog/2008/03/28/howto-use-git-for-personal-development-when-everyone-else-is-using-subversion-part-2/'>Part 2</a></li>
<li><a href='http://quirkygba.blogspot.com/2007/10/using-git-with-google-code-hosting.html'>Using Git with Google Code Hosting</a><br />A good overview for working with any Subversion repository.</li>
<li><a href='http://www.bluishcoder.co.nz/2007/09/how-to-publish-git-repository.html'>Bluish Coder: How to publish a Git repository</a> Some good ideas about publishing repositories</li>
<li><a href='http://jonas.nitro.dk/git/quick-reference.html'>Git Quick Reference</a></li>
<li>Fraser Speirs wrote this while <a href="http://speirs.org/2007/07/19/a-subversion-user-looks-at-git/">considering switching from SVN to Git</a></li>
<li><a href="http://www.friday.com/bbum/2007/07/19/git-will-eat-subversions-lunch/">Git will eat Subversion’s Lunch</a> by Bill Bumgarner</li>
</ul>
<p>And definitely watch <a href="http://www.youtube.com/watch?v=4XpnKHJAok8">Linus Torvalds&#8217; Google talk about Git</a>. It won&#8217;t tell you how to use Git, but he&#8217;s funny and the talk worth seeing.</p>
<h3>Getting Git</h3>
<ul>
<li><a href="http://code.google.com/p/git-osx-installer/downloads/list?can=3">Mac OS X Installation Binaries</a> (<a href="http://git.or.cz/#download">other OS&#8217;s</a> too)</li>
<li>And of course, TextMate support:  <a href='http://blog.macromates.com/2008/git-bundle/'>Git Bundle</a></li>
</ul>
<p>While Git itself is easy to compile from source, getting the documentation manpages built on Mac OS X Leopard is <a href="http://rails.wincent.com/wiki/Setting_up_the_Git_documentation_build_chain_on_Mac_OS_X_Leopard">a pain in the butt</a>. I futzed around with it a little, but gave up halfway through installing a seemingly endless line of dependencies. The Mac binary installer works perfectly well and is kept up to date. I&#8217;d rather spend my time using Git than installing it.</p>
<h3>Using Git</h3>
<p>I was blown away by some of the stuff Git can do. </p>
<p>In the Google talk Linus pointed out how all SCM packages could do branching and branching wasn&#8217;t a problem. Merging was. <a href="http://twitter.com/joemaller/statuses/817765239">Merging branches with Git is leprechauns and unicorns</a>. It&#8217;s almost too easy. After a few days I found myself branching all over the place, constantly creating new branches to test any idea I was having. Folding those branches back in was almost always quick and painless.</p>
<p>Interactive line-by-line commits mean it&#8217;s possible to commit single lines from a file instead of the whole thing. This is great if you happen to go off on a bender and change a zillion different things between commits. </p>
<p>Cherry-picking is also great, and saved my butt when I created a pretzel of branch history. Using git-cherry-pick I was able to straighten out my history completely within Git using Git&#8217;s tools with no loss of work.</p>
<h3>Conclusion</h3>
<p>I started writing this post at the end of May, it&#8217;s now early July and I&#8217;ve been using Git for a few months with no regrets. The only time I hold my breath is when I&#8217;m pushing changes back to SVN, though it hasn&#8217;t glitched on me since early June. The speed and flexibility of Git are a constant pleasure to work with. The pain of merging branches, which used to take entire afternoons with SVN, has almost become an afterthought.</p>
]]></content:encoded>
			<wfw:commentRss>http://joemaller.com/907/switching-to-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 1/35 queries in 0.035 seconds using disk: basic
Object Caching 465/538 objects using disk: basic

Served from: joemaller.com @ 2012-05-23 20:19:27 -->
