Github as a replacement for flash drives

Hi, I teach AP CS at a high school. This is my scenario:

Currently:
I put starter code on a LMS (canvas/blackboard) site.
Student creates Eclipse Java project and links to external libraries
Student creates the Java class files, then copy pastes the starter code into the files.
Student works on assignment, but runs out of time at the end of class.
Student does one of three things:

  1. Copy code into email, and email themselves so they can continue work at home. (most common)
  2. Copy code into dropbox, then work on home
  3. Copy code into google dropbox
  4. Copy workspace to USB drive to take home.

Lots of problems with these:

  1. The time it takes to do these.
  2. Student mixes up which version of the file to take home. Sometimes they accidently copy the blank file and realize wrong one is on the dropbox/cloud.
  3. Student annoyed that they have to re-create the project on their home Eclipse installation.

I’ve created an organization, got approved for the private repos for students.

I guess I’m confused about the workflow of PR’s… It seems too complicated.
Can GitHub just do this?

  1. Student creates local repo on their desktops.
  2. Every time they save, I want it to commit changes to the local repo (can this happen?)
  3. When they close eclipse, I want it to do a final commit and then copy the repo to GitHub.
  4. When they go home, they run eclipse, and they can easily sync the newest version of their code into their eclipse workspace.
  5. When they are done, it syncs the code to GitHub.
  6. When they come back to the classroom, it syncs the newest version back into their classroom.

Is this at all possible? Where do I start?

Hi @jwoodward! This is partially possible! And could be a great solution for your students! The only difference between your stated workflow and what is probably possible is that your students will have to save, commit, and push in eclipse before closing. Likewise, they will have to pull (or clone, for the first time) to their computer at home before they continue work.

I think this is well within the capabilities of your AP students. The biggest decision you have to make is how do you want your students to interface with git? Almost every major IDE, including eclipse, have built in source-control tools (EGit is the plugin for eclipse) and may be your best option, as it works well with eclipses workspace file management.

You shouldn’t have to worry about pull requests or branches at all if each project is an individual effort and you just want your students to have somewhere to put their code. They should be able to make all commits right on their master branch.

Basically, the workflow will look like this:

  1. Student accepts GitHub classroom assignment and is automatically redirected to their personal GitHub repository that is under your control. They will open this repository straight into eclipse using “Check out project from source control” and providing the GitHub url.
  2. Every time they save, they will also commit and push from the EGit interface. This is a relatively simple step that is a great habit to develop in young developers.
  3. When they close eclipse, they should already have saved, committed, and pushed their changes.
  4. When they go home, they run eclipse, and choose “Check out project under source control”, and provide the link to their repository, they receive their most recent version.
  5. They continue to make edits, save, commit, push.
  6. When they return to the classroom, they use git pull to retrieve their changes added from home!

I hope this helps! Please let me know if you need any clarification or have further questions.

-Chris

2 Likes

Ah thanks Chris!
I want to make sure that I’m using the terms correctly.

Eclipse Git says FETCH… is that term the same as PULL? (ah, FETCH is half of PULL, it’s when you are not sure you really want to merge the changes, but that’s useless for a classroom with only one developer)

Eclipse Git has two buttons COMMIT and COMMIT AND PUSH.

Does COMMIT only save changes to the local repo?

Does PUSH mean it saves changes to the local repo, and then copies the local repo to the cloud?

What is the difference between pressing COMMIT every save, and then just PUSH at the end of a student’s code session and then COMMIT AND PUSH every save?

Thanks!

Great questions! You’re dead-on about the fetch versus pull. pull is what is most appropriate for this use case.

commit creates a new commit, which is basically the set of the latest changes along with a log message in the local repository only. In order for these changes to be added to the version of the repository that is stored on GitHub.com, you must use push. Changes will not be added to the remote version of the repository (the one on GitHub.com) until you push.

So basically, yeah, you should recommend that your students use the commit and push button. :grimacing:

1 Like

Yeah, i’m sure all of this discussion is replicated on stackoverflow… thanks for posting in here despite that.

I think the biggest change was that in the old days, you just had one repo… .you never had a local one. So you were always checking out the file, and then pushing it back when you were done. It was a client server model…

Hi @jwoodward just piping in to let you know that we’ve shipped the ability for Classroom to integrate with your LMS

© 2017 GitHub, Inc.
with by
GitHub Education