git the konami code


git on a 3d cube background.

I’ve been using git for a few months now, and have found it faster and more enjoyable to deal with than svn. Sure, there’s the headache with remembering git revert is not like svn revert (use reset to go back to a point in time, revert to undo a commit—more like English, actually).

In addition to git, there’s github, a good place to host your public code repositories. I’m keeping an AS3 Konami Code project and my AS3 code library on github. You can clone them to your machine or fork them to create your own project on github.

It’s easy to get a repository started anywhere:
$ git init

Then you can add stuff to your next commit
$ git add stuffToCommit

Then commit it:
$ git commit -m "I added some really cool stuff to my project."

It’s all managed locally, so you don’t need to be online or ping a separate machine to figure out what’s changed. Inevitably, you’ll want to have your stuff backed up elsewhere, so it’s also easy to set up another location to push your repository to.

On the other machine:
$ mkdir repository.git
$ cd repository.git
$ git --bare init

On your machine:
//create a reference to the machine called ‘origin’
$ git remote add origin ssh://other.machine.info/repository.git
//push your ‘master’ branch to ‘origin’
$ git push origin master

To get stuff from your remote server back to your machine, or to copy everything to a new machine (if you’re working on multiple machines and want to sync up):
//use this if you have the origin setup
$ git pull origin master
//use this if you don’t have a repo setup locally:
$ git clone ssh://other.machine.info/repository.git

You can check the status of your repository and get a log of commits by using the $git status and $git log commands, respectively. And don’t forget to edit .git/info/exclude to avoid unnecessarily versioning things.

For more information on git, check out the sites I found useful on delicious.