Git & Github

You’ll collaborate with others and submit assignments through Git, Github, and Github Classroom.

Git: a version control software typically run in the shell/terminal of your computer that helps you keep track of the history of a document (updates, changes, etc.). We’ll use a user interface, Github Desktop instead of the shell/terminal.

Github: an online repository platform that facilitates collaboration between individuals and provides a space for you to showcase your work to others.

Github Classroom: an system within Github that helps students to create Git/Github repositories with starter code and files provided by the instructor for assignments.

Github Setup

Before the first day of class, follow these instructions below to set up the collaboration/version control software that we’ll be using throughout the semester. Please let me know if you have any issues going through these steps:

  1. If you don’t already have one, please create a (free) Github account/username. Go to https://github.com and register for an account (if you don’t have one already).
  • You’ll need to choose a username at this time. Think carefully about this because you may keep this account for a LONG time. Things to consider when picking a username.

    • Try to incorporate your name in it.
    • Reuse usernames from other accounts such as Twitter.
    • Pick a username you’d be ok sharing with future employers.
    • Shorter is better.
    • Make it timeless.
    • Avoid names with words that have special meaning in programming.
  1. Go to https://education.github.com/students to sign up for student benefits such as unlimited private repositories through Github Education.

  2. Please fill out this Google Form with your Github username so that I can add you to the Github Classroom.

  3. Download Github Desktop (https://desktop.github.com/). Follow the instructions to connect to your Github account and install Git, as necessary.

I want to make sure to get ahead of any technology issues (they will happen as they always do), so please email me if you encounter any issues!

Git/Github Overview

Basics of Git

Repository (Repo): A folder or directory that has been indicated for Git to follow changes over time.

Add: Users must tell Git to follow new files and/or subdirectories in the Repo.

Commit: A snapshot of the current status of files and subdirectories in the Repo with a time stamp and message/description.

Push: To communicate with collaborators, users must push their commits to the remote server (typically Github).

Pull: To see what your collaborators have done, users must pull any new commits from the remote server (typically Github).

Merge Conflict: When two collaborators are working on the same committed version of the files and change the same line in a file, there will be a merge conflict. In order to proceed, the 2nd individual attempting to push a new commit will need to resolve the conflict.

To resolve a merge conflict:

  • Open the file(s) that have been indicated to have a conflict.
  • Look for the problematic areas in the file(s).
    • They’re surrounded by <<<<<<< and >>>>>>>.
    • The content after the first marker originates from our current working branch (HEAD).
    • The line with seven equals signs (=======) separates the two conflicting changes.
  • Decide which code to keep and remove the <<<<<<< and >>>>>>> and ======= from the file. Save and commit before pushing.