<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Dave Dash</title>
 <link href="http://davedash.com/tag/git/atom.xml" rel="self"/>
 <link href="http://davedash.com/tag/git"/>
 <updated>2012-01-17T21:54:19-08:00</updated>
 <id>http://davedash.com/</id>
 <author>
   <name>Dave Dash</name>
   <email>dd+atom1@davedash.com</email>
 </author>

 
 <entry>
   <title>Using git to borrow from the future</title>
   <link href="http://davedash.com/2010/11/09/using-git-to-borrow-from-the-future/"/>
   <updated>2010-11-09T00:00:00-08:00</updated>
   <id>http://davedash.com/2010/11/09/using-git-to-borrow-from-the-future</id>
   <content type="html">&lt;p&gt;One of the great features of &lt;code&gt;git&lt;/code&gt; is the ability to re-order commits, break
commits into parts, and merge commits together.&lt;/p&gt;

&lt;p&gt;Assuming that my &lt;code&gt;master&lt;/code&gt; branch is a pristine copy of the site and an ancestor
of &lt;code&gt;mybranch&lt;/code&gt; we can re-order commits by running:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git rebase -i master&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will take all the commits in your current branch (&lt;code&gt;mybranch&lt;/code&gt;) that are
built upon &lt;code&gt;master&lt;/code&gt; and allow you to reorder or edit them individually,
remove them or squash them.&lt;/p&gt;

&lt;p&gt;For example you might get:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pick 123abcd New feature supreme
pick 123abce Whitepsace fixes
pick 2222222 Rename functions.
pick 123abcf rebase me
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The last commit listed is the latest commit and is where &lt;code&gt;mybranch&lt;/code&gt;'s &lt;code&gt;HEAD&lt;/code&gt;
points to.&lt;/p&gt;

&lt;p&gt;You can edit this like so:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pick 123abce Whitepsace fixes
pick 2222222 Rename functions.
pick 123abcd New feature supreme
f 123abcf rebase me
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will re-order history so the first three items happen and the &quot;rebase me&quot;
commit just gets rolled into the &quot;New feature supreme&quot;.  Note since this is a
rebase the commit hashes will change.  Let's say history is now this (reverse
chronological):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;323abcd New feature supreme
3222222 Rename functions.
323abce Whitepsace fixes
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Great?  Almost.&lt;/p&gt;

&lt;p&gt;There's a likely hood that your apps' unit tests will not pass after the commit
&quot;Rename functions&quot;.  Some functions may have been renamed somewhere later in
&lt;code&gt;mybranch&lt;/code&gt; possibly in &quot;rebase me&quot; which is now a part of &quot;New feature
supreme.&quot;&lt;/p&gt;

&lt;p&gt;This is a mess, but we can run &lt;code&gt;git rebase -i master&lt;/code&gt; again and edit the
&quot;Rename functions.&quot; commit.  If you run a test-suite and things fail you can
&quot;borrow from the future&quot;.  You see at this point &lt;code&gt;Rename functions&lt;/code&gt; is
something that happened in the past.  &lt;code&gt;mybranch&lt;/code&gt;'s head is now
&lt;code&gt;New feature supreme&lt;/code&gt; which is the future.  We can pick and choose little
changes with some &lt;code&gt;git&lt;/code&gt;-fu.&lt;/p&gt;

&lt;p&gt;While rebasing in the &lt;code&gt;Rename functions.&lt;/code&gt; we might notice that we forgot to
rename a call, but we remembered to rename this call at some point in
&lt;code&gt;mybranch&lt;/code&gt;.  We can simply do this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git checkout -p mybranch [paths]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will let you interactively select chunks of code from the head of
&lt;code&gt;mybranch&lt;/code&gt; and put it into your specific commit &lt;code&gt;Rename functions.&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can narrow this down by specifying some &lt;code&gt;paths&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Once we finish rebasing we'll have a commit history that is logically ordered
and have all tests passing tests.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>git svn rebase... forever?</title>
   <link href="http://davedash.com/2009/08/12/git-svn-rebase-forever/"/>
   <updated>2009-08-12T00:00:00-07:00</updated>
   <id>http://davedash.com/2009/08/12/git-svn-rebase-forever</id>
   <content type="html">&lt;p&gt;While working on &lt;a href=&quot;http://addons.mozilla.org/&quot;&gt;addons.mozilla.org&lt;/a&gt; I ran into an issue of &lt;code&gt;git svn rebase&lt;/code&gt; continually asking me to merge a file, over and over.&lt;/p&gt;

&lt;p&gt;I had a branch open for a bug.  In that branch I wrote a library.  While that bug was under review, I had to use that library in a new branch for another bug - and had to develop on it a bit.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ git co -b bug1 master
$ vi libs/mylib.php # make the lib
$ git add .
$ git commit -m &quot;my new lib&quot;
$ git checkout -b bug2 master
$ git checkout bug1 libs/mylib.php # copies this file from one branch to the next
$ git commit -m &quot;lib copied over&quot;
$ vi libs/mylib.php # hack on the lib 
$ git commit -m &quot;awesomized lib&quot;
$ git svn dcommit # push it up
$ git checkout bug1
$ git svn rebase #... oh shit
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So the rebase was happening.  This is git trying to merge your changes in bug1 and bug2 and play them together in realtime nicely, asking you each step of the way to merge things manually.  I thought something weird was happening since &quot;libs/mylib.php&quot; kept needing manual merging.  Then I noticed that git is applying a series of patches, and that eventually this will resolve and your site will be rebased.&lt;/p&gt;

&lt;p&gt;Don't lose hope, &lt;code&gt;git svn rebase&lt;/code&gt; will finish.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Comprehensive list of international dialing codes</title>
   <link href="http://davedash.com/2009/07/01/list-of-comprehensive-international-dialing-codes/"/>
   <updated>2009-07-01T00:00:00-07:00</updated>
   <id>http://davedash.com/2009/07/01/list-of-comprehensive-international-dialing-codes</id>
   <content type="html">&lt;p&gt;I get bored with mundane tasks.  So I create little adventures for myself.  I had to create a list of countries and country codes to use on the &lt;a href=&quot;http://mozilla.com/mobile&quot;&gt;Firefox mobile home page&lt;/a&gt;.  The first few lists were incomplete, so I made my own by parsing a list provided by the International Telecommunication Union.  I stripped it down to simple forms of the country names and removed codes that are very rare (satellite phones).&lt;/p&gt;

&lt;p&gt;Well this could be a boring task for most people, so I placed it on [github][http://github.com/davedash/International-Dialing-Codes/].  Feel free to use this in your own projects, I even include a perl one-liner in the README to convert this into a drop down HTML list.&lt;/p&gt;
</content>
 </entry>
 

</feed>

