You might want to know about … git

If you’ve got a couple of different folks working on the same code base, you need some version control. Emailing files back and forth is not going to work for very long. Trust me. Git is a distributed version control system that allows multiple users to work on the same code and resolve conflicts (like two people editing the same file at the same time.) Even if it is just you, version control is your friend. This used to work, and then you did … something … and now it doesn’t? Roll back to the version that worked.

Git is a free and open protocol. Anyone can implement it. And there are people who will tell you that what makes git great is that it doesn’t depend on a central hub. Which is true. That is pretty cool. It is also more or less irrelevant to you because you are going to use a central hub. Probably github, that’s what most people use.

The digital fellows have a very nice intro to git writeup, though it is more geared towards truly distributed collaboration.

Some quick github tips:

1. Don’t share a github account. Everyone should create their own account and then be added to the repository as collaborators.

2. If you’re using git to manage HTML and CSS files for your website, you may as well take advantage of github’s project pages. On github.com, create a new repository, and then add a new branch called gh-pages in your new repository. Head over to your repository settings and set the default branch to gh-pages.

Your HTML will all be accessible at username.github.io/repository. For instance, you can see the whole gh-pages branch of my CUNY-data-skills repository at http://amandabee.github.io/CUNY-data-skills/.

3. Github offers a pretty nice gui, but you don’t have to use it. You can just use command line tools. If you want to use git to manage the files on your Reclaim server, you can install git with sudo apt-get install git. Then you need to look at your repository to find out what the SSH clone URL is, but it is probably something like git@github.com:amandabee/workshops.git. You’d clone that repository with git clone git@github.com:amandabee/workshops.git and then from then on you can use git pull to update your code.

To install the commandline tools on OSX, you should start with Homebrew. Once that’s running you can install git with brew git. On Linux you want to use sudo apt-get install git. I’ve never used git on Windows, but you can certainly Google it, or just use the github gui.

If you get stuck, don’t hesitate to ask for help.