During the workshop today I got some questions regarding git and how it works in general. In order to use the examples provided for the workshops you don't need to know git at all, just use the download button in Github. Using git however, will enable you to do things more quickly, better structure your work and learn a thing or two that are useful when working in groups (and for your employment later ;)). So I figured I write a short introduction to get everyone started.
The first step is to install git on your platform from git-scm. If you run OS X and have Xcode installed you might already have git. Now open up a Terminal or the equivalent in Windows and type
Now you should see an output similar to
git version 22.214.171.124
Now configure git so that it identifies you by
git config --global user.name "Your name"
git config --global user.email "email@example.com"
With git installed, it is time to fetch the repository for the course. This can be done in a few ways depending on your intention. The first option is to clone it. This in all essentials means that you copy the entire repository to your own computer. Go the directory that you want to store the project in and type the following (for the 4ME102 course obviously)
git clone git://github.com/oskarp/4ME102.git
This should output something along the lines of
Cloning into '4ME102'... remote: Counting objects: 264, done. remote: Compressing objects: 100% (173/173), done. remote: Total 264 (delta 52), reused 258 (delta 46) Receiving objects: 100% (264/264), 171.62 KiB | 264 KiB/s, done. Resolving deltas: 100% (52/52), done.
Now you will have a copy of the repository from Github. For now, just accept that branches is a good idea to organize your work, so let's create a branch that you can work on. Do this by typing
git checkout -b mybranchname
You can now switch back and forth between the original (on the master branch) and your version (on mybranchname) and the files will change accordingly in your workspace by typing
git checkout branchname
In case you want to contribute by fixing bugs in the examples you will need to fork the repo to your own Github account however, since the public git address is write protected. Next guide will go trough that.
This guide was only a very brief introduction. To read up on git, please check out any of these guides