Mini Lab: Gitting Started

Monday, Jan 22, 2018
Monday, Jan 22, 2018 by 10:30pm
Work with your assigned partner for this lab. You can use online resources for your lab, provided they do not provide complete answers and you cite them in your code. If you do not know whether it is acceptable use a specific resource you can always ask me.


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 collaborate with your partner, and you’ll have a chance to tell me a little bit about yourself and ask questions about the course. In the future we will use a slightly different GitHub workflow, but this will serve as a good starting point if GitHub is new to you.


Please work with your assigned partner on this in-class lab.

Group information is no longer available for this course.

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 future labs I will set up GitHub repositories for you and your assigned partner(s) at the start of class, but I do not yet have your GitHub usernames. Instead, this time you will work in a fork of the repository for the lab. For this assignment, you will turn in your work by submitting a pull request. I won’t accept your pull request—this would incorporate your answers into the starter code—but I can review your changes and leave comments if necessary.

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/gitting-started, forked from csc213/gitting-started.”

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.