Thursday, July 1, 2010

Getting git

My plan is to host all my NXT projects using Google Code and SVN. However, a few days ago I discovered github and git and it sounded really cool. Last night I tried to see how it works so I created a local git repository for some code that is going to be used with my Arduino (the app itself is hosted with Google App Engine which is free for the volume of code and traffic I have).

Because I want to be able to share the project between a couple of computers on different networks, I looked for a server where I can create a central repository - yes, I know, the strength and beauty of git is the fact that there is no need for this but I tried anyway. I discovered gitorious so I created a project there and pushed a portion of my local project to it - I don't want the entire project, because it contains Eclipse files and library jars that get created/installed when I create the project on a different computer.

From the other computer I tried to clone this repository (using git clone) but because the destination directory already existed I had troubles doing this. I kept digging for info about how to do this but couldn't find any (I'm sure it's out there and it was only my fault for not finding it). Finally, I got an idea: if git init creates a repository and git pull gets the code, why not try it this way. And it worked.

So, for my future projects that will be in this situation where I want to souorce control only a few files, what I need to do when moving to a new computer is:
  • create the new project
  • start git and cd to the project dir
  • instead of git clone do: git init
  • followed by: git pull git@gitorious.org:<project>/<repository.git>
Like I said, I am sure this info is out there somewhere but I couldn't find it so I am posting it here for future reference. When reading/learning about git, I found a lot of info on different website but there are a couple resources I want to mention in particular:

No comments:

Post a Comment