Session 3 More Git and Intro to GitHub


By the end of this session, you will be able to:
  • navigate important parts of a GitHub repository
  • design methods that use/modify attributes
  • create your own repository on GitHub
  • push local changes to a remote
  • fork and clone an existing repository



  • Notebook
  • Writing instrument
  • Laptop - with git config and SSH key connected to GitHub as detailed in the Computer Setup
  • Headphones & mic
  • Zoom permission to share screen for breakout sessions

Housekeeping, Wins/Follow-Ups, and Goals


  • Most common answer to git question from survey: “I can name the steps of the git workflow and can put them in practice (using a reference).”
  • This is expected, and we use references as programmers on the job all the time, at some point it’ll be muscle memory
  • Great job asking and answering each others questions in the public channel!


  • We’re in the process of leaving feedback on everyone’s session 1, be sure to check your gists!
    • Suggestions there are for your benefit
  • Make sure that you’re checking slack at least once a day
  • Session 3 HW due Thursday
  • Be sure to stay at your home directory or below

Today’s Goals

(See above)

Warm Up

SSH Check

In your terminal (use shortcuts if you can) check if your ssh keys are configured correctly by running the command below and seeing a success message:

$ ssh -T
Hi <your_username>! You've successfully authenticated, but GitHub does not provide shell access.

In the Slack thread, reply with your output after running the $ ssh -T command!


Last week, we briefly talked about keyboard shortcuts in the Mac environment and in Chrome. You should also learn and practice these terminal and atom shortcuts.

Try it: Practicing Shortcuts


Use these shortcuts to quickly move around within your terminal.

  • Cycle through past commands
    up arrow
  • See all commands previously typed
    type "history" in the command prompt
  • Clear Command Line
    control + u
  • Clear Terminal Window
    command + k
  • Open New Tab
    command + t
  • Cycle Through Terminal Tabs
    control + tab
  • Goto Beginning of Line
    control + a
  • Goto End of Line
    control + e
  • Fast Moving Cursor Through Command Line Text
    Right: option + right-arrow
    Left: option + left-arrow
  • Stop Any Terminal Process

    Stuck? Not sure what's going on with your Terminal? This is the command to use.

    control + c
  • Atom

    Use these shortcuts to quickly move around within your text editor.

  • File Finder
    command + t or command + p
  • Toggle File Tree
    command + \
  • Highlight Current Line(s)
    command + l
  • Highlight Current Word
    command + d
  • Find in page
    command + f
  • Find and replace in project (use with caution)
    command + shift + f
  • Split panes
    command + k ..unpress keys.. + arrow key(choose direction)
  • Intros, Review, and Icebreaker

    groups of 2 or 3 (5 minutes)

    Person with the lightest color shirt speaks first.

    1. Introduce yourself: name, pronouns

    2. Share: What is your favorite warm weather activity? When's the last time you did it?

    3. What metaphor would you use to describe the git staging area (git add)?

    Have extra time? Share helpful resources you've come across.

    Class and Method Review

    Try It: Methods

    In your notebook, write down a sentence about a class using this structure:

    Each _______ (class) can ___________, __________, and ___________.

    Example: Each BankAccount (class) can deposit_money, can withdraw_money, can open, can close, and can change_ownership (methods).

    Method and Attribute Interaction

    Like we talked about during session 2, a method of a class defines behavior/actions. Methods are generally verbs (action words or very short action phrases). Methods generally answer the questions “What things can instances of this specific class do?” or “What can be done to instances of this specific class?”

    Most of the time, a method will either use or change an attribute of an object. For example, look at the attributes of the class Bank Account below:

    Class: Bank Account
    Attributes (____ has a/an _____):

    Here are some Bank Account methods and the attributes that would be used/changed. Notice that these are all verbs or action phrases.

    change_owner (modifies the owner_name attribute)
    deposit (modifies the balance attribute)
    withdraw (modifies the balance attribute AND uses the over_draft fee if the balance drops below $0)
    display_account_info (uses the owner_name and balance attributes)

    Example #2

    Look at the Car class and its attributes below:

    Class: Car
    Attributes (____ has a/an _____):
    amount_of_gas (integer)
    paint_color (string)
    number_of_carseats (integer)
    engine_on (boolean)
    passengers (array)
    last_oil_change (datetime)

    Try It: Methods with Attributes

    Post two sentences in the chat about the Car class using this structure:

    The ____________ method [modifies/uses] the _____________ attribute.

    Example: The start_engine method modifies the engine_on attribute.

    Make sure that your method names are verbs or action phrases.

    Git Review - groups of 2 or 3 (10 minutes)

    Let’s talk once more about this Git diagram.

    Git Workflow Diagram Source:

    We’ll start by repeating the group git exercise from the last session. This may seem repetitive, but each time you practice, you’ll gain muscle memory and procedural understanding.

    Today’s driver will be the person who was born closest to the state of Indiana. Everyone else will be navigators. Driver: remember not to type anything that has not yet been brought up by a navigator and discussed in the group.

    The driver will be the person typing the commands, but the navigators should be the ones who brainstorm what comes next or what to type. In addition to naming the steps, discuss why you are doing each step, or what exactly is taking place in each step.

    Remember: If you feel comfortable with git, your job is to hone your explanation and communication skills. Many companies in the industry that place far more weight on these professional skills than on being a technical superstar.

    Try It: Git Review

    As you and your group walk through the git review below, it might be a good idea to have Session 2's Git Notes open.

    1. Before we do this, make sure the driver is in the home directory by typing cd
    2. Create a new directory called session_3_git_practice. Inside of that directory, create three files called coding_languages.txt,programming_terms.txt, andgit_terms.txt.
    3. Tell git to start watching the session_3_git_practice directory.
    4. Before you check the status, predict what it will say. Then, check the current status.
    5. Add coding_languages.txt to the staging area.
    6. Make your first commit in this directory. What should the commit message here be?
    7. Before you check the status, predict what it will say. Then, check the current status.
    8. Add programming_terms.txt andgit_terms.txt to the staging area.
    9. Make your second commit in this directory. This commit should include both files from the previous step. What should the commit message here be? Why? What conventions have we talked about?
    10. Use atom to add the names of two separate coding languages to coding_languages.txt. You may Google "programming languages" if you can't think of any.
    11. Before you check the status, predict what it will say. Then, check the current status.
    12. Before you check the difference between your last commit and what the file looks like now, predict what it will say. Then, check the diff.
    13. Add the changes to the staging area.
    14. Before you check the status, predict what it will say. Then, check the current status.
    15. Commit the changes using a properly formatted commit message.
    16. Before you check the status, predict what it will say. Then, check the current status.
    17. Repeat steps 10-16 again, adding the names of some programming terms and some git terms to the respective files.
    18. Add and commit the changes to these two files together with a properly formatted commit message.

    Finished before time is up? Repeat, but choose a different driver this time.


    Git is not the same as GitHub. They work together, but they are separate tools. Git allows us to track versions of our work on our local computers. GitHub is an online git repository hosting service. A repository (or repo) is, at it’s core, a place where your work and commits are stored.

    Other alternatives to GitHub include GitLab and BitBucket, among others. GitHub (and these other services) also makes it easy for teams that use git to collaborate on the same codebase.

    During Mod 0, we will not be exploring the collaborative functionality of GitHub. We’re going to stick to learning the basic functionality of GitHub.

    Let’s first discuss this diagram:

    Github Diagram


    origin: refers to the URL where the code is hosted on GitHub. Each repository has its own origin (own URL).

    git pull: means download all of the changes and updates on the remote GitHub repo that I don’t currently have on my local repo. You would use git pull after a teammate makes a change to the code, and you want to bring those changes into your own code.

    git push: this is how you share/upload the changes you made to your local repository on GitHub.

    This diagram shows how GitHub can be used as a collaboration tool:

    Collaborative Github Diagram


    Let’s take a look at an example of a repo on GitHub: FreeCodeCamp

    Try It: Exploring GitHub Repositories

    groups of 3 or 4 (8 minutes)

    In your breakout group, choose one of the repositories listed at the bottom of this "Try It" section. Take a few minutes to explore the following questions and be ready to report back to your group:

    1. What is this project about?
    2. How many commits have been made in the repository?
    3. Approximately how often are changes made to this repository? How do you know?
    4. Who is the top contributor?
    5. How many people have contributed to the repository?
    6. Done before time is up? Pick a second repository to explore.



    Turn off your mics and videos and walk away from the computer. Stand up, stretch, drink water. Do a few sit-ups, squats, push-ups, jumping jacks, arm circles, stress ball squeezes, or whatever else moves your body.

    Creating a Remote Repo on GitHub

    Watch and take notes while we walk through how to add a remote to your local repository. This assumes we already have a repository initialized with git locally.

    1. Visit
    2. Click the plus button in the upper-right corner of GitHub and select “New Repository” from the dropdown.
    3. Give your repository a name, and dont worry about adjusting any of the other settings for now.
    4. Scroll down and click “Create Repository”
    5. Scroll to …or push an existing repository from the command line
    6. Paste the lines listed, one at a time, in your terminal. Make sure to follow instructions for SSH
    7. Refresh Github. Tada! Your project is there.
    groups of 3 or 4 (8 minutes)

    Try It: Adding a Remote

    1. Create a new repository on GitHub called git_homework.

    2. In your terminal, navigate to your git_homework directory from session 2's homework. If for some reason you don't have this directory then use the mkdir command to create git_homework. Then use touch to create a file calledsample_file.txt. Then run git init. Only do this if you don't already have a git_homework repo.

    3. Add the remote to your local repository, then push your changes to GitHub.

    Making Additional Changes and Pushing to GitHub

    Watch and take notes while we walk through how to continue making changes and pushing those changes to GitHub.

    Try It: Full Git Workflow

    groups of 3 or 4 (10 minutes)

    In your breakout rooms, everyone will complete the steps below synchronously, but on your own projects. Use each other as resources and sounding boards. Don't hesitate to click "share screen" if there's something you want your team to look at!

    If you get really stuck, you can click "ask for help" and we'll pop into your room.

    • Add a few new quotes to your quotes.txt file.
    • Save your file using the shortcut command + s.
    • Go back to your terminal.
    • Use commands to add and commit your new changes. Be sure to use git status to check your status, and make sure your commit message is properly formatted.
    • Push your new changes to GitHub.
    • Refresh the page to make sure the new changes appear.
    • Repeat the above steps, but this time, remove one of the quotes from your quotes.txt document, then add, commit, and push your changes.

    Finished? Get to know your breakout room classmates better: What are they trying to get better at in life? What book would the recommend that everyone read at least once in life?


    What is Forking?

    Forking allows you to copy someone else’s project while still keeping a reference to the original. To fork an existing project, you just click the fork button, which will make a copy of all of the code and directory structure to your own GitHub account.

    You can tell if something is a fork because it will say “forked from [original repo name]” underneath the title.

    Once you’ve forked a repo, click the green “Clone” button to get the URL to clone.

    git clone <insert URL here>

    If you fork, clone, make changes, and push to origin, it will work because it’s pushing to your forked origin (YOUR account), not the original repository (ORIGINAL CREATOR’s account). To push those changes:

    git push


    git push origin main

    (In our case today, both commands will do the same thing)

    Things to Note: Cloning with Git

    • Never clone a remote repository within a preexisting Git repository. If you watched the video for modifying your .zshrc, then you will see [main] if you're already in a git repository.
    • After cloning a repository, remember to cd into the directory you just cloned to your machine before running commands. If you cannot remember what the directory is called then runls after cloning to see the contents of your current directory.
    • There is no need to run git init within a repository that you cloned down to your local machine. Remote repositories that you clone to your local machine have already been initialized by git. You only ever need to run git init when you've created a repository locally from scratch. If you mess this one up, it's not going to cause any problems; it's just unnecessary.
    • Don't use "Initial commit" as your commit message for a cloned repository. Whoever made the repository already did that. You only need "Initial commit" when you make a new repository for yourself.

    Try It: Forking

    groups of 3 or 4 (8 minutes)
    1. Fork the Best Animals repository.
    2. Clone your fork using your terminal.
    3. Open up the project in your text editor (atom).
    4. Add a few animals to the mammals.txt file.
    5. Add and commit your changes.
    6. Push your changes to the origin (which is your fork).
    7. Done? Repeat steps 4-6 with another animal file.

    Homework and GitHub Projects

    Business as usual. Reach out on slack if you’re stuck!