I am not sure why this isn’t built-in to Homebrew, but if you frequently want to update all outdated packages like I do, this command should help out:
Maybe I should contribute a similar command?Unless you have been sleeping under a rock, which I hear is good for your health, you have come to hear about Git. Originally created by Linus Torvalds, Git is an open source version control system that has quickly gained a lot of traction with Rails developers. This could be credited to the great GitHub, but I think it is because of Git’s feature set. Visit the office Git website to learn more.
At $20 a month Media-Temples Grid-Service is an incredible bargain. I make extensive use of all of it features, including the recently added ability to host Git repositories. What follows is a tutorial on how to host your Git repositories on Media Temple’s Grid-Service from Mac OS Leopard.
There are binaries available for installing Git on Mac OS X. Visit the git-osx-installer project on Google Code.
In order to be able to clone your repositories from the Grid over HTTP you need to create a domain specifically for Git. You can setup git.domain.com, but any domain will do. Remember to setup the domain in your Grid account. Without this you will only be able to clone Git repositories over ssh which is a pain.
We are going to setup an example project called icecream-man. Change into a directory that is safe to work in and let’s get to it. If you already have a Git project setup you can skip this section.
# This is where I keep all of my projects
cd Sites/
mkdir icecream-man
cd icecream-man
git init
touch .gitignore
git status
git add .
git commit -v -a
Before we can push our local Git repositories to the Grid we have to create a bare clone. A short aside about what git means by bare: A default git repository assumes that you’ll be using it as your working directory, so git stores the actual bare repository files in a .git directory alongside all the project files. Remote repositories don’t need copies of the files on the filesystem unlike working copies, all they need are the deltas and binary what-nots of the repository itself. This is what bare means to git. Just the repository itself.
cd Sites/
git clone --bare icecream-man icecream-man.git
touch icecream-man.git/git-daemon-export-ok
To get the project on our Grid I use scp, but you could just as easily FTP the icecream-man.git directory into your Grid account.
scp -r icecream-man.git serveradmin%s#####.gridserver.com@s#####.gridserver.com:domains/git.domain.com/html/icecream-man.git
Now we have to ssh into our Grid account and finalize the setup.
ssh serveradmin%s#####.gridserver.com@s#####.gridserver.com
cd domains/git.domain.com/html/icecream-man.git
git --bare update-server-info
chmod a+x hooks/post-update
Now we are ready to clone our Git repository from our Grid account. We are able to clone using a pretty URL thanks to our Git specific domain. Yeah!
git clone http://git.domain.com/icecream-man.git
Once you have made some local commits that you want to push to the Grid you can use this command:
git push ssh://serveradmin%s#####.gridserver.com@s#####.gridserver.com/home/#####/domains/git.domain.com/html/icecream-man.git master
Here is what I do so that I do not have to type in that long command every time I want to push my changes to the remote Git repository. Git allows for each project to have multiple tracked repositories. Since we cloned our project from http://git.domain.com/icecream-man.git Git thinks it can push there to. Let’s add another remote repository and tell Git to push our changes there.
cd Sites/icecream-man/
git remote add grid ssh://serveradmin%s#####.gridserver.com@s#####.gridserver.com/home/#####/domains/git.domain.com/html/icecream-man.git
Now we can push changes to our Grid account using git push grid master. Git knows that the remote repository named grid corresponds to the Grid’s push URL. Much better, I know. We can take this even further and create an alias for the command in our “.bash_login” file. To view the available remote locations type “git remote” from inside the project directory. Then you can view the details of a remote repository by typing “git remote show grid”. I use this very heavily, and am successfully hosting six active Git repositories on my Grid account. Without this tiny shortcut I do not think I would be able to do it, and I would be GitHub bound.
You have surely heard of the latest thing to happen to version control. Git, written be Linux creator Linus Torvalds, is a popular version control system designed to handle very large projects with speed and efficiency. Installing Git on Mac OS X Leopard is actually pretty simple and blazingly fast. It installed so quickly I thought it was a mistake.
Terminal skills
export TCL_PATH=/usr/bin/tclsh export NO_MSGFMT=1
With those environment variables set we can move on to building Git.
# Get and Install Git
curl -O http://kernel.org/pub/software/scm/git/git-1.5.6.2.tar.bz2
tar xjvf git-1.5.6.2.tar.bz2
cd git-1.5.6.2/
./configure
make
sudo make install
cd
That’s it, enjoy.
July 9, 2008: Git binaries are now available from the official git-osx-installer Google Code project.