Posts Tagged ‘github’

Using git and github for course assignments

Tuesday, January 10th, 2017

Here’s my tested plan for using git and github to manage student assignments for my upcoming course.

Initial setup as the instructor:

We’re going to create a student repo and an instructor fork for each assignment. The motivation for separating assignments is to ensure that the diffs that students are submitting for their solutions are tidy. In my case, there’s not much shared code between assignments

Create public* repo that students will see: test-gp-hw0-student.

If you try to fork this on Github, it will tell you that you already have a fork. So instead trick github into forking it via the github importer, import test-gp-hw0-student as a private test-gp-hw0-instructor. Now you have two repos. We’ll set up a branch on test-gp-hw0-instructor to track test-gp-hw0-student for easy merging:

INSTRUCTOR_REPO=test-gp-hw0-instructor
STUDENT_REPO=test-gp-hw0-student
git clone https://github.com/alecjacobson/$INSTRUCTOR_REPO.git
cd $INSTRUCTOR_REPO
git remote add student https://github.com/alecjacobson/$STUDENT_REPO.git
git fetch student
git checkout -b student-tracker --track student/master
git checkout master
cd ..

To test this out, let’s create a file visible to everyone (students and instructors) in the student repo:

git clone https://github.com/alecjacobson/$STUDENT_REPO.git
cd $STUDENT_REPO
echo "visible to everyone" >> hello-everyone.md
git add hello-everyone.md
git commit -m "add file visible to everyone" hello-everyone.md
git push
cd ../

Now, let’s merge change into the instructor repo

cd $INSTRUCTOR_REPO
git checkout master
git pull student master
cat hello-everyone.md
cd ..

Just to be thorough, let’s try the reverse: creating a file just visible to instructors:

cd $INSTRUCTOR_REPO
echo "visible to just instructors" >> hello-instructors.md
git add hello-instructors.md
git commit -m "add file visible to just instructors" hello-instructors.md
git push
cd ..

Getting assignment and handing in assignment as the (dummy) student

Open an incognito/private window and create a new github account for a fake student (pro tip: gmail lets you put dots anywhere in your email address so that alec.jacobson@gmail.com redirects to alecjacobson@gmail.com, but most websites don’t recognize that these are the same). My fake students name is stewartdent.

Clone the repository and try to access the instructor repo (assuming the url was leaked):

git clone https://stewartdent@github.com/stewartdent/$STUDENT_REPO.git stewartdent
cd stewartdent
git remote add instructor https://stewartdent@github.com/alecjacobson/$INSTRUCTOR_REPO.git
git fetch instructor

You should see an error:

remote: Repository not found.
fatal: repository 'https://stewartdent@github.com/alecjacobson/test-gp-hw0-instructor.git/' not found

Now, let’s act as the student to submit the homework

# cd stewartdent
echo "stewartdent was here" >> assignment-01.md
git add assignment-01.md
git commit -m "Stewart Dent's Assignment 01 submission" assignment-01.md
git push
cd ..

The student has pushed their submission onto their own repo. They can continue to work on it using git in all its glory. When they’re down they “hand in” their homework via a pull request onto the public test-gp-hw0-student repo. The student does this by visiting the Github page for their own fork of test-gp-hw0-student and clicking “New Pull Request”.

Grading as the instructor

The instructor can now grade this. I’m imagining that the test-gp-hw0-instructor repo has a solution that can be compared (in some way or another) to the students work. To pull the students work into the instructor copy (but never merge):

cd $INSTRUCTOR_REPO
git checkout -b stewartdent-master master
git pull https://github.com/stewartdent/test-gp-hw0-student.git master
cat empty-form.md 
# Record grade.
git checkout master
git branch -D stewartdent-master

Then the instructor can close the pull request on test-gp-hw0-student.

Other perks

Questions or discussions related to the homework can be conducted on the “issues” page of test-gp-hw0-student

* The fact that this repo is public should immediately indicate that student’s work submitted via pull request will also be public and importantly will be visible to other students. Unlike the most common form of cheating, this means that Student A can copy the work of Student B without the explicit consent of Student B. Student B’s only possible defense against this would be to submit their work just before the deadline. As far as I know, I can’t hide pull requests from the public (that would be a nice solution) and I prefer not to use any method that relies on student’s having to create a private fork (since they cost money; although, other class require very over-priced textbooks, so a 6-month github subscription is not so crazy, but it does go against the open-source spirit; there’s also the Big Tobacco style get’em while their young https://education.github.com/pack).

Code and presentation slides for Nested Cages

Monday, February 1st, 2016

nested cages teaser

We’ve released the source code and presentation slides for our paper Nested Cages, presented last November at SIGGRAPH Asia 2015.

Purge big files (and their version history) from a git repository

Wednesday, December 23rd, 2015
  1. fork the repo (e.g. using github web interface) and never touch the original again until confident that everything below worked
  2. clone fork
  3. cd fork
  4. git rm all big files
  5. git commit -m “removed big files”
  6. bfg –strip-blobs-bigger-than 20K .
  7. git reflog expire –expire=now –all && git gc –prune=now –aggressive
  8. git push origin –force master

Verify (e.g. on github website) that both repositories look as expected.

qslim for Mac OS X on github

Wednesday, April 15th, 2015

A while ago I patched Michael Garland’s qslim to compile on modern Mac OS X. I’ve finally wrangled in the instructions and modified files to a github repo. There are also wrappers for this tool in my gptoolbox. It’d be cool to have a proper C++ API to this tool, but that’s future work.

Qslim is one of the seminal mesh decimation/edge-collapse/simplification techniques. It’s fast, simple and predictable. It’s a good starting place if you’re trying to simplify your mesh, especially in an automated way.

Libigl on github

Wednesday, February 26th, 2014

libigl tesaser

We’ve migrated libigl, our simple C++ library for geometry processing, to a public github repository. Hopefully this makes it a bit easier for others to use.

If you’re interested in trying libigl just head over to our github repo and clone a copy.

If you’re interested in helping the development of libigl, contact me and I can add your github username to our team.

Enjoy!