<?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>22 idea street &#187; Git</title>
	<atom:link href="http://22ideastreet.com/blog/tag/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://22ideastreet.com/blog</link>
	<description></description>
	<lastBuildDate>Thu, 19 Aug 2010 17:12:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>git svn</title>
		<link>http://22ideastreet.com/blog/2009/09/28/git-svn/</link>
		<comments>http://22ideastreet.com/blog/2009/09/28/git-svn/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 19:00:51 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=855</guid>
		<description><![CDATA[I recently had a chance to use the Git interface to Subversion (git-svn), and it&#8217;s the best way that I&#8217;ve found to work with Subversion (SVN). Using git-svn is better than using plain SVN. The primary reasons I feel this way are that it provides a convenient staging environment and superior local branching capabilities. The [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/09/28/git-svn/">git svn</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I recently had a chance to use the Git interface to Subversion (git-svn), and it&#8217;s the best way that I&#8217;ve found to work with Subversion (SVN).  Using git-svn is better than using plain SVN.  The primary reasons I feel this way are that it provides a convenient staging environment and superior local branching capabilities.</p>
<p>The staging environment provided by Git means that I have a local version control system that no one else can see.  This allows me to take continually check things in without worrying about mucking up the general repository.  I like this because I can make changes quickly and check in whenever I make progress and things mostly run correctly.  This is great because I hate it when things are improving and then I make some boneheaded change to a bunch of files and can&#8217;t figure out how to get back to a working state.</p>
<p>When I&#8217;m ready to check into the shared repository (in SVN), I can do this as a separate operation.  What&#8217;s nice is that I can squash, modify, and reorder local commits so that my development history is clean of the rabbit trails that inevitably pop up.  Theoretically, the staging environment allows me to not need to run full test suites before locally committing to ensure that I don&#8217;t break the build.  This was not really a gain that I utilized though.</p>
<p>The second advantage was quick local branching capability.  This allowed me to have several streams of development going that were mostly independent of each other.  This was invaluable for quick bug fixes, and helped when work was blocked due to a client member being unreachable.  Another great advantage was the ability to have my master branch be clean and always be ready for a demo.  Git branches differ significantly from SVN branches, in that they are much faster to work with, require less space, and, perhaps most importantly, Git offers better merging capabilities.</p>
<p>Everyone else on your team can still use SVN normally, and you will see their changes if you use the correct workflow.  There are numerous sites that describe this workflow and variations of it, so I won&#8217;t detail this.  Just Google &#8216;git svn workflow&#8217;.</p>
<h4>Issues</h4>
<p><i>Attention conservation notice:  heavy Git nomenclature to follow, probably not useful for the casual reader.</i></p>
<p>I ran into a couple of problems that I&#8217;d like to discuss, and my final solution.  One issue was that I developed for quite awhile in Git and then needed to put this into the client&#8217;s SVN repository.  There are numerous risks that I should have mitigated by doing this as I was going along with the project.  I did not commit against my better judgment because I thought that my code structure might change significantly.  However, it never really did.  In the future I won&#8217;t hesitate to do this now, as the pain of messing around with version control is not really all that high.  </p>
<p>I initially was interested in keeping my development history around, but this turned out to be pretty hard based on some specific things that I did.  I think that the main reason for this is that I wanted my commit messages to have the correct name and email.  I&#8217;m pretty sure I changed this setting in ./.git/config, but something must have gone awry.  Hence, I ran a one-liner at the command line similar to the following:</p>
<pre>
git filter-branch --env-filter "export GIT_AUTHOR_NAME='&lt;my name&gt;';
                                export GIT_AUTHOR_EMAIL='&lt;my email&gt;';
                                export GIT_COMMITTER_NAME='&lt;my name&gt;';
                                export GIT_COMMITTER_EMAIL='&lt;my email&gt;'" HEAD
</pre>
<p>However, when then subsequently running git-svn commands, I received this error:  <i>Can&#8217;t call method &#8220;full_url&#8221; on an undefined value at /usr/lib/git-core/git-svn line 425.</i></p>
<p>My understanding of what this error means is that git-svn can&#8217;t find a join point between local development and your remote branch.  Running the git-svn init or clone commands sets this up correctly, but what I was doing messed it up.  I think I lost quite a bit of time by not understanding that rewriting the history at the end (which I typically did) would cause git-svn to get out of sync.  I also messed around with grafts for awhile, which probably didn&#8217;t help matters any.  I think in retrospect I probably should have only rewritten commit history for commits that I did locally, and not mess around with grafts at all.  This would have probably allowed me to just `git svn rebase` to keep my history and have a flurry of checkins with the right information.  But at this point, I was alright with losing my development history since I had already spent a bit of time working on it.</p>
<p>Once I was ready to import my changes, I found the following process to be helpful.  Basically I add SVN directories, sync with these directories, copy over the files in master from my local directory, then commit the changes and dcommit to SVN.  First, let&#8217;s add the standard SVN layout to the SVN repo.  If you&#8217;re worried about messing something up, doing this process locally first is helpful, and then doing it to a sandbox directory might be advisable.  See <a href="http://eikke.com/importing-a-git-tree-into-a-subversion-repository/">this page</a> for an example of the former.</p>
<pre>
&gt; svn co &lt;repo/folder&gt;
&gt; cd &lt;folder&gt;
&gt; mkdir trunk tags branches
&gt; svn add trunk tags branches
   A         trunk
   A         tags
   A         branches
&gt; svn commit -m "Base directory structure."
   Adding         trunk
   Adding         tags
   Adding         branches
   Committed revision 1.
</pre>
<p>Then in a clean directory, you can execute:</p>
<pre>
# the --prefix=svn/ gives you remote branches prefixed with svn/
# which helps to namespace them
&gt; git svn clone &lt;repo/folder&gt; -s --prefix=svn/
   Initialized empty Git repository in &lt;folder&gt;/.git/
   Using higher level of URL: &lt;repo/folder&gt; => &lt;repo&gt;
   W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '&lt;folder&gt;'
   W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
   This may take a while on large repositories
   r1 = &lt;treeish&gt; (svn/trunk)
   Checked out HEAD:
     &lt;repo/folder&gt; r1
&gt; cd &lt;folder&gt;
&gt; git branch -a
   * master
   svn/trunk
</pre>
<p>I&#8217;d modify your .git/config file to have the correct username / email if necessary at this point.</p>
<p>Then you can copy all of the files from your original working directory (the one where you did all of the development) <b>except for the .git directory</b>.  If you copy this over, you&#8217;ll have to start all over again.  At this point:</p>
<pre>
> git status
   # all of your files
> git add .
> git commit -m "Changes from my local repository."
   Created commit &lt;treeish&gt;: Changes from my local repository.
   ...
</pre>
<p>And finally:</p>
<pre>
# in case someone updated the SVN directory that you're working with (unlikely)
> git svn fetch
> git svn dcommit --dry-run
   Should see something about pushing to &lt;repo/folder/trunk&gt;
> git svn dcommit
   A file1
   # etc....
</pre>
<p>This should add your files in the trunk folder in the SVN repo.  Hope this helps!</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/09/28/git-svn/">git svn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2009/09/28/git-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing and Revision Control</title>
		<link>http://22ideastreet.com/blog/2009/09/25/writing-and-revision-control/</link>
		<comments>http://22ideastreet.com/blog/2009/09/25/writing-and-revision-control/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:00:49 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Pandoc]]></category>
		<category><![CDATA[Source Control]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=698</guid>
		<description><![CDATA[I have been doing a lot of writing lately and was interested in automatic versioning so I could see the results of writing over time and how things change. I think that it would be really interesting to see a visualization of a book being written from scratch. Normally you only see the end product; [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/09/25/writing-and-revision-control/">Writing and Revision Control</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I have been doing a lot of writing lately and was interested in automatic versioning so I could see the results of writing over time and how things change.  I think that it would be really interesting to see a visualization of a book being written from scratch.  Normally you only see the end product; tracking changes over time would allow others to see the sausage being made.  This could be useful for teachers to help their students improve their process, for writers to analyze their craft, or for aspiring writers to see how books really get written.</p>
<p><a href="http://22ideastreet.com/blog/diffs/9d11fad06f7906241b6d71a071933a0ebccd58ec.html" target="_blank">Here&#8217;s a demo</a> of what I envisioned using <a href="http://22ideastreet.com/blog/2009/09/02/caps-lock-remix/">a recent blog post</a> that I wrote using the following method.</p>
<p>The system uses git for version history.  I also used a Vim hook that checks in the current file on buffer writes:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;">cabbr autocommit <span style="color: #804040;">call</span> Autocommit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #804040;">fun</span><span style="color: #000000;">!</span> Autocommit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
  au BufWritePost <span style="color: #000000;">*</span> silent <span style="color: #000000;">!</span>git <span style="color: #25BB4D;">add</span> <span style="color: #000000;">&lt;</span>afile<span style="color: #000000;">&gt;</span>
  au BufWritePost <span style="color: #000000;">*</span> silent <span style="color: #000000;">!</span>git commit <span style="color: #000000;">&lt;</span>afile<span style="color: #000000;">&gt;</span> <span style="color: #000000;">-</span>m <span style="color: #C5A22D;">'Generated commit'</span>
endfu</pre></div></div>

<p>This is about the finest grain of editing that I can imagine being useful and that was practical to do.  Anything lower-level and you&#8217;re probably looking at the document as the cursor is moving around.  Commits are nearly instantaneous, and you can amend commits to explain complicated changes.  Git branching seems to work well with this system.  Hence, you can have multiple streams of writing.  If you&#8217;re working with other people, you could be writing a new chapter when you get some feedback on the last chapter which you would like to add.  Simply create a branch from the time that you sent the document out, and you should be able to see exactly what the reviewer saw.  In addition, authors of collaborative works can use the push/pull functionality to manage copies, which is probably better than emailing documents around.  See <a href="http://en.wikibooks.org/wiki/LaTeX/Collaborative_Writing_of_LaTeX_Documents">this page on collaborative writing</a> for more ideas.</p>
<p>As far as the current visualization goes, I used a Ruby suite that I found called <a href="http://www.kt.rim.or.jp/~hisashim/docdiff/">DocDiff</a>.  I think that this based on or uses <a href="http://www.gnu.org/software/wdiff/">wdiff</a>, a difference engine focused on words.  Based on my understanding, wdiff writes each word to a line and uses the standard GNU diff algorithm to detect changes.  Anyway, DocDiff seemed to fit for a rough visualization of the changes between each commit, so I used this and hacked together the navigation with some further scripting.</p>
<p>Improvements could include at least:</p>
<ul>
<li>a more accurate diff function</li>
<li>showing diffs in the opposite direction when you go backwards in time</li>
<li>representing branching</li>
<li>advancing changes automatically instead of manually</li>
<li>showing sections moving smoothly in real-time</li>
<li>Doogie Howser typewriter noises <img src='http://22ideastreet.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>highlighting backgrounds a different color when the final words used are in their correct places</li>
<li>showing commit information in a corner for context</li>
<li>showing the product over time based on the source (think PDFs with images)</li>
</ul>
<p>For blog writing, I&#8217;ve been pretty happy sticking with HTML, although <a href="http://daringfireball.net/projects/markdown/">Markdown</a> would probably be better.  For longer works, I have recently found <a href="http://johnmacfarlane.net/pandoc/">Pandoc</a>, which is a Haskell-based Markdown-and-more implementation with fewer bugs than the standard Markdown interpreter.  You get support for other file formats, conversion between file formats, and the ability to write documents to PDF using LaTeX!  LaTeX is nice for editing large works, but it can be cumbersome to read at times.  Pandoc allows you to use Markdown for most things, and then switch to LaTeX mode for things like equations.  Markdown seems to play well with versioning and seeing changes over time as well.</p>
<h4>Non-programmers</h4>
<p>I pretty much agree with all of the points Derek Hammer brings up in <a href="http://blog.derekhammer.com/?p=40">Personal Source Control</a>.  On a Linux machine, I would contend that git is pretty painless to set up, although you still need to realize that you&#8217;re starting something worth tracking.  It&#8217;s not automatic yet.  Plus, there&#8217;s the learning curve of actually using the system.  It&#8217;s not fully in the background.  And to the overall points, I definitely think that putting your local files and documents under version control is a great idea.  If it&#8217;s so easy that users don&#8217;t need to think about it, then it&#8217;s an advance.</p>
<p>I read a book a couple of months ago called <i>About Face 3:  The Principles of Interaction Design</i>, and the authors talked about going to a more document-oriented user interface model.  The book gives some interesting examples to why this is a good idea.</p>
<p>Pretend you have never used a computer before.  Would it be intuitive to rename the word processing document you are currently editing by clicking &#8220;Save As&#8230;&#8221; and saving it as a different file and then deleting the original?  I think this makes little sense because thinking about files is more of an implementation detail than how people actually think about their projects.  I don&#8217;t really care if the computer is storing my document in a hard drive, the cloud, or a shoebox, I just want to be able to rename a file I currently have open.</p>
<p>Versioning of documents should undergo the same analysis.  Manually choosing to track changes and then being inundated with the visualization is a chore.  And when users forget to track changes&#8230;?  Complex merging is a chore regardless of how diligent users are.</p>
<p>While I was looking for a system that would check in text files automatically and push to a central repo when I was ready, I saw <a href="http://lifehacker.com/5232049/flashbake-automates-version-control-for-nerdy-writers">an article about flashbake</a>, a git- and cron-based system of recording writing changes.  While I&#8217;m not all that interested in what song was playing when I committed, having contextual information might be helpful in some cases.</p>
<p><a href="http://wave.google.com/">Google Wave</a> has a pretty nice way of replaying waves (conversations) that resembles the revision tracking system in a wiki.  I could see using this for a personal knowledge management system when it comes out.  It&#8217;s definitely nice because it should be accessible from many different platforms as long as you have an internet connection.  One downside for me is the fact that you are not in full control of the data (backups, privacy, security.)</p>
<p>As far as collaborative text editors, I&#8217;ve looked into <a href="http://gobby.0x539.de/">Gobby</a> for some work projects.  It had the best quality that I saw, you can see everyone in the session typing in real-time with different colors and no locks, and it&#8217;s cross-platform compatible FOSS.</p>
<h4>Other thoughts</h4>
<p>Here is an article about <a href="http://www.ashbykuhlman.net/blog/2002/12/19/2341">using relative dates</a>.  This seems like a helpful concept.  Instead of saying that I read <i>About Face</i> a couple of months ago, I could put in an approximate date and then let software do the translation.  This might be nice so that people know that I&#8217;m probably not interested in talking about the book when they stumble upon this post in a couple of years.  Many things on the internet are time-specific, so anything to state this clearly seems to be moving in the right direction.  I can&#8217;t think of how many times I&#8217;ve read something and thought, &#8220;this doesn&#8217;t seem quite right,&#8221; and then looked for a date and realized it was horribly out of date.  Using more relative dates is a semantic web thing.</p>
<p>I&#8217;d like to see even more histories of documents on the web, with linking to specific versions of documents.  This would enable programs to cache the documents that you link to, and if the contents change or have newer versions, you can be alerted to this fact so that you can update your references.  Instead of having fully broken links when a page is down, your web server would just fall back to the caches of the documents.  This would all but ensure that useful pages are backed up in a distributed fashion.  People seeking to restore a lost site or link could run some sort of script that is aware of sites that are backing up external sites, and link to those caches, adding further redundancy.  This reminds me of Linus Torvalds saying (hopefully tongue-in-cheek):  &#8220;Backups are for wimps.  Real men upload their data to an FTP site and have everyone else mirror it.&#8221;  There would obviously be logistical hurdles to overcome if someone manually changes their cache, if versions get out of sync, etc.</p>
<p>While we&#8217;re at it, let&#8217;s add transparency to government operations.  Consider every change to every bill in the legislative branch and every signing statement having an associated author, time, and commit message explaining the rationale.  Then citizens could see who really makes positive changes to bills and who to hold responsible for the pork.  Are you sure you want to release a hundred changes one minute before voting is to begin on the House floor?  True &#8220;blame&#8221; and &#8220;praise&#8221; (from an SVN perspective.)</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/09/25/writing-and-revision-control/">Writing and Revision Control</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2009/09/25/writing-and-revision-control/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
