Updating assignments after creation?


(Matt Price) #1

I posted an assignment earlier than I should have, and a bunch of my students have already accepted the invitation. However… my starter code needed some work, and I would like to update the starter code. I thought the student repos would be forks of my starter code… but they’re not. So I don’t think they can git pull upstream or similar. I see @djholt suggested a manual command-line pull in this thread. Hmm. Is that still the recommended solution? I will get students to do this if necessary, but I’m worried there will be a lot of grief if I do. What have other people done?

As always, thanks for the help!


Submission and Grading Workflow (Redux)
(Chris Cannon) #2

I often have to add additional information for assignments after the fact, and the only way to do it without deleting the assignment is to manually make the changes to each repository. I recommend using something like this mass clone utility to retrieve each repository and then use something similar to this addfile.py script to add the updated file, commit and push.

Note that addfile.py script is rather hacked together, I know it works perfectly on my machine but I can’t guarantee it will on yours.


(Matt Price) #3

ah, those two scripts are great, thank you @ccannon94. Just used those two tools to push the update, it worked great.

addfile.py requires python2, so I just had to execute explicitly with python2 addfile.py to get it to work on Arch Linux.


(John Pham) #4

If you want to run it as a executable, you can add this hash bang to the top of the script /usr/bin/python2.


(Vanessa) #5

@titaniumbones Matt, hopes this answers your Qs.

Thanks to students and Campus Experts @JohnPhamous and @ccannon94 :sparkling_heart:


(Maueroats) #6

I have students add my master repository as an upstream repo, so they can pull changes automatically. I provide a script in the base directory that looks something like this:

#! /bin/sh
# Type ./update to run this file
git add remote upstream "..."
git pull upstream master

If there are downsides to this, let me know. I’m still new at this.


(Matt Price) #7

I was thinking of doing something like that, instead of the addfile method that @ccannon94 uses above – if only to keep the git history in sync with the master repo. Anyway, yes, my question is more or less answered, and I hope to cobble together some scripts in the next day or so and share something a little more systematic in my other thread


(Paul Wilson) #8

If no student has accepted the invitation yet, can I edit the assignment still? Or is the best solution to simply delete the repo and recreate the assignment from scratch?


(Waqar Saleem) #9

A student and I tested just this some 30 minutes ago on her machine and faced the following issues.

  • git commands like add or commit fail right after git pull upstream master. The error message complains about the inability to write to .git/index.lock and suggests that some other git process may be running. We could not find any other running git process. The fix we found was to manually delete the .git/index.lock file.
  • Only changes made in the upstream repo after it has been added are pulled. For example, imagine the following time line.
    – Time A: You release the assignment and the student accepts.
    – Time B: You make changes in your repository.
    – Time C: She does git add remote upstream "..." followed by git pull upstream master
    She will not get the changes from Time B as they were made before she added the remote upstream.

These issues make this otherwise attractive option unworkable. If anyone has fixes, please share.


(Waqar Saleem) #10

Same here! All this time I had been making changes in my repository and asking them to git pull. I just now learned that what the students actually did was to copy the files I told them I had changed from the assignment repository (which was thankfully public) to their own.