Git on Mac OS X
Okay, forget what I just said about svn on OS X. This week, I'm moving one of my projects into a private repo on github. Why? Well, obviously because it's the new hotness. Because all the kids are doing it? Actually, the answer is "why not?". It can't hurt to learn another source control tool, and I've heard enough good reviews from friends to make me want to see what all the fuss (or lack thereof) is about.
The first step is to set it up locally, though. Start by downloading git: http://git-scm.com/download
If you really want to compile it yourself (and normally I would), there are some fairly verbose guides here and here.
I found this installer first though - it worked without a hitch: git-osx-installer
Pop open a terminal and check out your git install:
Check the status of your repo (similar to svn's 'svn info'):
One other thing to note: If you're using github, you'll be creating a local config file that sets up your connection to the github repository. You'll be able to check out, but you may need to add an extra line to allow you to push code back up to github (for more details, check here):
The first step is to set it up locally, though. Start by downloading git: http://git-scm.com/download
If you really want to compile it yourself (and normally I would), there are some fairly verbose guides here and here.
I found this installer first though - it worked without a hitch: git-osx-installer
Pop open a terminal and check out your git install:
$ git help log
$ git --version
$ git
Now back to the code - I tarred up my existing project (originally in svn):
$ tar cvfz project.tar.gz --exclude=.svn projectfolder/
Remove the directory:
$ rm -rf projectfolder/
Untar the project again, cd into the folder, and run init:
$ tar xzf project.tar.gz
$ cd projectfolder/
$ git init
Add the project to a git repository:
$ git add .
And commit:
$ git commit
The git commit process reminds me of cvs - assuming you're in the terminal and using vi, you'll have to open the file, insert your comment, then close and save in order to complete the commit.
Check the status of your repo (similar to svn's 'svn info'):
$ git log
One other thing to note: If you're using github, you'll be creating a local config file that sets up your connection to the github repository. You'll be able to check out, but you may need to add an extra line to allow you to push code back up to github (for more details, check here):
$ vi .git/config
In the "remote" section, make sure you have that last line:
[remote "github"]
url = git@github.com:git_username/projectname.git
fetch = +refs/heads/*:refs/remotes/origin/*
push = refs/heads/master:refs/heads/master
Comment by
Brian Rosner
on Nov 18, 2008:
This is a git blog post, but I just have to point out something. You didn't need to use tar to remove the .svn directories. That could have been easily done using svn export. svn export projectfolder newprojectfolder ; mv newprojectfolder projectfolder :D
Comment by
Markus
on Jan 31, 2009:
It is also possible to import directly from a svn repos. An even sync back. As far as I read about it. I will try it i near future.
Comment by
Seth Johnson
on Nov 25, 2009:
Even better than gzipping or copying is just removing the files with find, xargs, and rm:
find newprojectfolder -name ".svn" | xargs rm -Rf
Comment by
Jon
on May 22, 2010:
I am wondering if you could provide any direction on how I uninstall or remove git from my computer?
This is a Mac running OsX. I am very new to Mac and Git and I'm not sure if I installed it right, so I want to try and start over by uninstalling it completely, they beginning again.
Any info on how to do this is appreciated.
Thanks
Jon

