Lab: Gitting Started

Assigned: Monday, Jan 23, 2017

Due: Wednesday, Jan 25, 2017 at noon

Collaboration: You should work with your neighbor on this lab.

We will be using the version control tool git for much of our work in this class. In case you haven’t seen git in an earlier class, this is a tool that helps you work collaboratively and incrementally on files, specifically source code files. We will also be using the git hosting site GitHub to store our git repositories and submit assigned work.

In this lab, you will practice using GitHub to submit your work and tell me a little bit about you.

Part A: Set up a GitHub account

Some of you may already have GitHub accounts, but if you do not have one, or you would prefer not to use your main GitHub account for school work, go to the GitHub signup page and create an account. Both of you will need to create GitHub accounts before proceeding.

Part B: Fork the lab repository

Git is used to manage files within a repository, effectively just a directory that contains files or other directories. One of the primary methods for collaboration with GitHub is through forking repositories. A fork is a complete copy of a repository at a particular point in time. Once you have forked a repository, you can make changes to your local copy regardless of whether or not you have permission to change the source repository. Once you have finished making changes, GitHub allows you to submit a pull request, which tells the original author that you would like your changes to be incorporated into the original repository.

For each lab in this class, you will work in a fork of the starter repository for the lab, then turn in your work by submitting a pull request. I won’t accept your changes (this would make the starter code into completed assignment) but this allows me to comment on your work.

The starter repository for this lab is located at One of you should create a fork of this repository by clicking the “fork” button in the upper right corner of the page.

Clicking the button will take you to your copy of the repository, which should say at the top “username/datavis-intro, forked from grinnell-cs/datavis-intro.”

Part C: Add a collaborator

The next step is to give your partner access to this repository. Click the settings tab above the repository file list, then go to the “Collaborators” section. Add your partner as a collaborator by typing in their GitHub username and clicking “Add Collaborator.”

Part D: Add one student’s answers

One of you should fill in your answers to the lab questions in the file. Do not add your partner’s answers, just your own. You can do this by cloning the repository to your local machine, but for this simple assignment we will make the changes directly on GitHub.

Click on the file in the file browser, then click the pencil icon to edit this file. Follow the directions in the README file to fill in one of your sets of answers.

In the section below the file editor, add a brief comment for the changes you made. Something along the lines of “Added John Doe’s answers” would be reasonable. Make sure the option to commit directly to the master branch is selected, then click “Commit changes.”

Part E: Add the other student’s answers

Now that one of you has committed your changes, log out of GitHub and log the other student in. Go to the forked repository (it should appear in your list of repositories on your GitHub homepage). You can now edit the same way as before to add your answers to the file.

Part F: Submit a pull request

Once you have committed your changes to the repository, you can submit a pull request to submit your work. On the main repository page, click the green “New pull request” button. This will take you to a view that shows all the changes that were made by either lab partner since forking from the main repository. The settings above this diff view control where the pull request goes and what you are comparing to, but the defaults should be correct in this case.

If you are happy with the changes, click the “Create pull request” button, and you’re done! If you need to go back and make changes, just abandon the pull request, make your edits, then create a pull request as before.