You need git to send in assignments. You will receive the skeletons for your solution through git, presumably use git to version your intermediate steps, and when you’re all done, you’ll push your changes to the server, where we’ll grade them. This file tells you the basic commands that you’ll need to solve the exercises and to handle git.
Where to get git
If you’re using a Unix-like system (e.g. Linux, Mac OS X or Open Solaris) you can simply download and follow the instructions on the official web page.
Windows user have some more struggles. We highly recommend installing a Linux distribution like Ubuntu as this way you also get to know those kind of operating systems. But there is also a native Microsoft Windows port, called msysgit. A other possibility is the use of Cygwin for Windows.
Generate your ssh key
Here, and in the rest of this text, lines that start with a dollar sign ($) are to be issued on the command line and off course without the $-sign.
If you know what you’re doing, you can skip this. This creates your ssh key:
$ ssh-keygen -t rsa
You can (but shouldn’t) change the directory and enter a password but we do not recommend doing so.
Send us your ssh key
In your terminal go to the directory you saved your ssh-key and rename the public file with
$ cd /home/johndoe/.ssh/
$ cp id_rsa.pub john-doe.pub
(johndoe with your name, here and in the rest of this article.)
~/.ssh/john-doe.pub (note: only .pub file!) to: firstname.lastname@example.org and add your name, matriculation number and your group colleague. Then, wait for your confirmation. You will get your group number with your confirmation.
Clone your group’s repository
$ mkdir P2
$ cd P2
$ git clone email@example.com:group01
(replace 01 with your group number)
$ cd group01
Issue the following commands:
$ git config --global user.name "John Doe"
$ git config --global user.email "firstname.lastname@example.org"
$ git remote add p2ubungen email@example.com:p2ubungen
(Replace John Doe and firstname.lastname@example.org with your full name and email address)
Get exercise skeletons
These are the code skeletons that you will have to adapt or look at for completing your tasks. The following command copies the skeleton into your repository.
$ git pull p2ubungen master
Set up Eclipse
Eclipse is the program where you’ll write your code. Get it from eclipse.org.
Now, open Eclipse. Set your workspace to the folder: “group01”, i.e. the repository root.
Import the p2-tasks by choosing from the menu: File > Import … > General > Existing Projects into Workspace.
Here are the commands that will get the code into your local repository, and into the public server, that your group and the TAs can see.
Retrieve latest exercise skeletons from server
$ git pull p2ubungen master
Create a topic branch
Every time you work on changes that go together, you should do so in a topic branch. The version history gets more readable that way.
$ git branch Problemset1
$ git checkout Problemset1
As soon as you’re finished working on your branch or you like to take a break you probably like to keep the changes you did and add a comment. (It doesn’t has to be a good comment on your topic branch but it has to be good on the master branch!) You commit like this:
$ git add .
$ git commit
And as soon as you’re finished with the current task you can merge it into the master branch. Therefore you should checkout the branch you’d like to merge in.
$ git checkout master
Then you merge the Problemset1 branch into the master branch. The —squash option allows you to choose a good comment now, which is mandatory by the task.
$ git merge --squash Problemset1
$ git commit
One sentence describing the new state of the code
Detailed explanation what you exactly did and changed. This part can be as long as necessary but remember: Brevity is the soul of wit.
Names of the files that changed.
Example of a good commit message:
Task: Implement a file filter. Solution passes
all provided unit tests, and we added a few more.
Retrieve your group’s changes from server
$ git pull --all
Upload to server
$ git push origin master