Github & Github Classroom

 

Rodney Dyer, PhD

Git ?

Look Familiar?

What is Git

Git is a distributed versioning system

  • Easy for collaboration.
  • Easy track entire history of changes in your projects, documents, and code.
  • Complete history of all changes.
  • Easily revert to previous instances.
  • Project Based.
  • Branching

Lifetime of a Document

Consider a single file. After the first edit, you now have two differents ones.

graph LR
  A[File v1] -->|Edited| B[File v2]

In Google Docs, you can see the version history (and revert) while in Word you can use track changes to see edits but revisions are more complicated…

Persistence through Diffs

What we do not do is keep multiple versions of the file around as complete files. What is done is that the original document and only the changes made to the file—called diffs—are saved.

Lifetime of a Document

Add a new figure to the file and now you have three different entities.

graph LR
  A[File v1] -->|Edited| B[File v2]
  B -->|New Figure| C[File v3]

Lifetime of a Document

Perhaps the figure did not work out, and you decided to replace it with an image.

graph LR
  A[File v1] -->|Edited| B[File v2]
  B -->|Figure| C[File v3]
  B -->|Table| D[File v4]

For each new “revision”, you create a separate instance of the file itself.

Lifetime of a Document

Continue editing and making revisions.

graph LR
  A[File v1] -->|Edited| B[File v2]
  B -->|Figure| C[File v3]
  B -->|Table| D[File v4]
  D -->|Edited| E[File v5]

Lifetime of a Document

Eventually, you finish making revisions to the file.

graph LR
  A[File v1] -->|Edited| B[File v2]
  B -->|Figure| C[File v3]
  B -->|Table| D[File v4]
  D -->|Edited| E[File v5]
  E -->|Submitted| F[Thesis!]

Git allows you to have access to the entire history of the file and can revert to any of the previous version you want to.

Lifetime of a Document

Not all documents are incremental. Submitting for publication requires a different layout, citation format, etc. than for your thesis. Both of these are derived from File v5 as different branches.

graph LR
  A[File v1] -->|Edited| B[File v2]
  B -->|Figure| C[File v3]
  B -->|Table| D[File v4]
  D -->|Edited| E[File v5]
  E -->|Submitted| F[Thesis!]
  E -->|Submitted| G[Publication]

Git in Projects

This is a process that can include hundreds of files, data sets, images, shapefiles, etc. It is a Project Based approach.

And the entire project is referred to as a Repository.

Remote Locations

A git repository can live in many places.

  • On your laptop
  • On the lab computer
  • On a thumb drive (please do not use these any more)
  • On your home computer
  • On you iPhone

Synchronizing Repositories

Having a single remote Repository allows you to keep all the remote repositories in sync.

  1. Establish Repository on GitHub.
  2. Clone that repository to your local computer.
  3. Make changes.
  4. Commit changes when you are at a logical stoping point.
  5. PUSH the one or more committed changes to GitHub.
  6. On other computers with local copies, you PULL changes from GitHub to retrieve any changes you’ve made.

Pulling & Pushing.

For all these computers, you need to make sure you are pushing changes to GitHub from your current machine so that when you get to the next computer you can pull down these changes.

Collaborations

With a GitHub repository, several people can contribute to the same project and have access to the same content.

  • Can lead to conflicts
  • Merging files

GitHub

Github Classroom

Github Classroom

Just like “Canvas” but using Git and Github For interactions.

Assignments

Each ‘Assignment’ is located in its own GitHub Repository.

  • Each individual must be registered with the class (e.g., I need your GitHub login).
  • One source of data, documents, etc.
  • I will post a link to the GitHub Classroom assignment on Canvas.
  • You clone the assignment and it makes a special version for you.
  • You work on it and when you are done (or want to get some feedback), you push it back to GitHub.
  • In GitHub, the code can be examined and commented on. Any changes I make are then pushed back and you can see them.

Example Assignment Workflow

Example Assignment Workflow

You will work on the assignment. Commit changes as necessary. And when you are finished, you will push it back to the original repository.

Assessment & Diffs

Comments and Feedback

GitHub Classroom has the ability to facilitate feedback and chat based upon each push and commit. The dialog box here opens this ability.

Dialog

Dialog

Which can include all kinds of feedback.

More In-Depth Evaluation

Some—OK almost all—assignments are more complicated and need more than just a visual inspection of a text/markdown file.

  1. Instructor can clone your repository.
  2. Run code and render output.
  3. Provide feedback and assessment.
  4. Push back to repository.

Instructor Commit Messages

Kept in Commit Record

Questions

If you have any questions, please feel free to either post them as an “Issue” on your copy of this GitHub Repository, post to the Canvas discussion board for the class, or drop me an email.

Peter Sellers looking bored

 

Return to the GitHub Repository.