Read my latest article: 8 things I look for in a Ruby on Rails app (posted Thu, 06 Jul 2017 17:59:00 GMT)

git-svn is a gateway drug

Posted by Fri, 11 Apr 2008 03:28:00 GMT

As we’re migrating away from Subversion to Git, I’m having to learn a lot about git-svn. Andy has posted a few articles on this topic, but I wanted to share a quick tip that I find myself forgetting.

Working with Subversion branches

While you’re hopefully already familiar with how great local branches are with Git, you might not know that you can connect local branches to remote branches in your Subversion repository. This allows those of us who are using Git locally to work against Subversion branches.

I’m going to assume the following:

  • Your team is using Subversion
  • Your team already has a branch that you’re working in
  • Your team is following Subversion directory conventions (branches/, tags/, and trunk/)
  • You have Git installed (with SVN extensions)

Checkout the Subversion project with Git

Please visit Andy’s tutorial, Git SVN Workflow, for a more detailed explanation of the following commands.

First, we’ll initialize your new local Git repository with git-svn.


  git svn init -s http://svn.yourdomain.com/repos/project_name

Now, you’ll change directories to your new Git repository.


  cd project_name

Let’s fetch all previous revisions into your local repository1.


  git svn fetch

Great, once this is done… you’re master (local) branch is linked to trunk/.

Mapping a local repository to a remote branch

Assuming that your team is working in a Subversion branch on the current iteration of work. Our team has a naming convention for branches for each iteration. For example, if we’re in Iteration 18, we’ll write this as ITER-018 everywhere (Basecamp, Lighthouse, Subversion, etc…). At the start of each iteration, we create a new branch with this naming convention.

For ITER-018, the Subversion branch would be located at:

  • http://svn.yourdomain.com/repos/project_name/branches/ITER-018

If you were to do a git branch -r, you should see ITER-018 show up in the list. Now, the one thing that wasn’t clear when I first read the git-svn documentation was that you can’t just checkout that branch with one command. In fact, this has tripped me up a few times.

First, you’ll need to checkout a new local branch. I’ve opted to come up with my own convention for local branches and in this case, I’ll name it iter_018.


  git co -b iter_018

So, now I’m in the iter_018 branch, which is local. I’m currently still mapped to trunk/, which isn’t what we want. However, all we need to do is reset where Git is currently pointed to. We can run git reset to point this to the ITER-018 branch.


  git reset --hard ITER-018

That’s it! Now, the local iter_018 branch will point to branches/ITER-018 in your Subversion repository. This will allow you to work with your existing repository branch and still reap the benefits of local Git repositories.

What about master?

Good question. The git reset command that you ran will ONLY apply that that individual local branch. So, master is still pointing to trunk/. This will allow you to have several local branches that map to remote branches.

Next Steps…

If you’re working with Git already.. great!

If you’re working in an environment that using Subversion, git svn provides you the ability to start exploring Git without making your entire team switchover. Perhaps your a consultant and working for a client that uses Subversion… no problem!

We’re still using Subversion for past client projects and are considering GitHub, which just launched (to the public) today for future projects. A few of us are already using GitHub for open source projects.

Fun.. I just saw the following tweet pass by as I began to wrap up this post.

rails on github
Uploaded with plasq’s Skitch!

Check out Rails on GitHub!

The Gateway Drug… Git reminds me of Cake

Questions?

I know that I glossed over a few things, so feel free to post questions and/or tips for others who are looking to dabble with Git.

1 You’ll likely have problems if you don’t have a Git authors file specified in your git config.

1Password and Fluid.app

Posted by Fri, 04 Apr 2008 14:22:00 GMT

I’ve been really happy with my purchase of 1Password so far. If you’re not familiar with it, I would really recommend their free-trial. I’ve been really impressed with how quickly it became reliant upon it. 1Password works across several browsers, imports existing passwords, and even has integration with your iPhone. However, over the past month, I’ve been wishing that it worked with my Fluid applications.

1Password 2.6.BETA-2 was released a few days ago one of the features added was integration with Fluid applications.

Fluid and 1password
Signing into Lighthouse with 1Password

I’m glad to see that Agile Web Solutions was so quick to respond to the flurry of people requesting this.

Related Post(s)

iPhone's Missing Feature

Posted by Fri, 04 Apr 2008 00:17:00 GMT

I love my iPhone. There… I said it.

There is one problem with it (and I don’t blame Apple for it). Multimedia Messaging is pretty much non-existent with non-iPhone friends & family. My family continues to send me pictures/videos via text message… because they can with their other friends and family. I find myself looking at the following message quite often.

IMG_5279.jpg
Uploaded with plasq’s Skitch!

Then I go to AT&T’s AMAZING site…

viewmymessage is shit
Uploaded with plasq’s Skitch!

...and I get a broken image.

Great work AT&T! Apple… this is tainting my experience with the iPhone. Make them fix it!

I am forking Rails

Posted by Wed, 02 Apr 2008 20:01:00 GMT

...well, creating a fork on GitHub. ;-)

fork rails
Uploaded with plasq’s Skitch!

It appears that Rails is moving from Subversion to Git!

Courtenay posted this a little while ago.


git clone git://github.com/rails/rails.git

Check it out the Ruby on Rails project on GitHub.

Start working on your next patch with git…


git clone git://github.com/rails/rails.git
cd rails
git br -a
git br my_patch
git co my_patch

This is cool news. :-)

Older posts: 1 2