Managing Your Repository
All your code for this semester goes in a single Git repository that your instructor has already made for you on GitHub. We use version control—and Git and GitHub, in particular—for several reasons:
- Version control is a nearly universal practice in industry.
- If your computer fails or disappears, your work will still be on GitHub—provided you've been pushing up your changes at the end of each work session.
- When you have a coding question, sharing code with your instructor is much easier through GitHub than through inaccessible screenshots, out-of-context code snippets, code dumps on the public discussion board that violate the academic integrity policy, or grunting and pointing at the overly dim screen of your laptop during office hours.
- Your instructor can offer feedback on your project milestones directly in your code by means of a pull request.
Every time you work on a lab, reading exercise, or project, you should put the code you write in this repository. After each work session, you should commit and push this code to GitHub—no matter its state of completion.
Git is complex software designed for a complex task. However, most issues with version control arise when multiple people are contributing to a repository. Since you are the only software developer contributing to your repository, you won't have to deal with many of these issues.
To get your Git repository up and running, complete the following tasks.
Make Accounts
Your repository has already been made and is waiting for you. Follow these steps to be added to it as a contributor:
Install Software
Follow these steps to install the software that you'll use to write code and synchronize it with your GitHub repository:
git
in a terminal.Clone Your Repository
Your repository is currently only a remote repository. Follow these steps to mirror or clone it onto your local machine:
Cloning needs to be performed only once per computer that you use.
Daily Workflow
Each work session involves just these few steps, which will quickly become second nature:
README.md
file with a short blurb describing your hopes and dreams for this repository.You are strongly discouraged from uploading files directly to your repository using GitHub's website. Use this opportunity to learn how to use version control properly.
If you use more than one computer, you'll want to start each work session by pulling down any changes committed from other computers.