Skip to content

Instantly share code, notes, and snippets.

@shawnhank
Forked from jim-clark/pull-upstream.md
Created April 19, 2025 06:24
Show Gist options
  • Save shawnhank/c716b6ef9bd0f4ddd1b73d14a5f58c8c to your computer and use it in GitHub Desktop.
Save shawnhank/c716b6ef9bd0f4ddd1b73d14a5f58c8c to your computer and use it in GitHub Desktop.
Obtain Updates to Class Repos (Course, Lectures & Assignments)

Obtain Updates to Class Repos (Course, Lessons & Assignments)

Let's see how to pull updates made by your instructors to these class repos that you previously forked/cloned:

Verify That You Added an upstream Remote

  1. In Terminal, move into the repo that you'd like to pull from, for example,
    cd ~/code/ga/Lessons
  2. List the remote(s): git remote -v
  3. The output should list both an origin (pointing to your fork) and an upstream (pointing to the target GA repo above that you're pulling from). Note that there are two entries per remote.
  4. IF you are missing upstream: git remote add upstream <copy/paste the repo's url (green Code button)>
  5. IF the upstream remote's URL is incorrect: git remote set-url upstream <copy/paste the repo's url (green Code button)>
  6. Verify any updates you made: git remote -v

Commit Any Changes You Have Made Within the Local Repo

Run the same two commands as always used to commit your work:

  1. git add -A
  2. git commit -m "Your Commit Message in Present Tense"

Pull Updates Made by the Instructors

To pull down updates to the remote repo made by your instructors, run:

  1. git pull upstream main

Push Updates to Your Fork

Pulling the changes to your local repo does not automatically update your fork. To update the fork, run the usual command that you've been using:

  1. git push (assuming that you have previous ran git push -u origin main

🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment