Git and GitHub: The Basics

Jonathan Peake

Users, organizations, and teams

 

Users

  • Your account

  • Connected to your NOAA email

  • Can add secondary email

Users, organizations, and teams

 

Organizations

  • Shared account with large number of people

  • Can be housed under Enterprise

  • Collaboration and controlled access

Users, organizations, and teams

 

Teams

  • Nested within organization

  • Sub-groups for collaboration and access

  • Can have teams within teams for more fine-scale structure

Repositories - the main unit

  • Sets the folder and file structure

  • Contained and permissioned

  • Public, private, or internal (Enterprise)

  • Commits and issues - Contributing through GitHub

Commit

  • A specific “thing” that you want to save and keep a record for

  • Snapshot of all the files in the entire project

  • Commit messages provide info about the “thing” you’ve done

  • Commits give a history of the project

Cloning, Forking, Importing, and Branching (oh my!)

Cloning

  • Making a local copy from GitHub

  • Allows local sync within and across devices

  • Push local changes, fetch remote changes

Image credit: https://jaisriram.hashnode.dev/how-to-clone-a-github-repository-to-local-machine

Forking

  • Adding to or modifying repository hosted on someone else’s account

  • “Sees” changes from parent repo - allows syncing with parent

  • Can be for personal purposes - doesn’t have to be pushed to original repo!

Image credit: https://www.earthdatascience.org/workshops/intro-version-control-git/pull-request/

Importing

  • Use another repo as starting point for your own

  • Copy not connected to original

  • Usually meant for importing from a different version control system (e.g., GitLab)

    • Can be employed to use another GitHub repo as a “pseudo-template”

Branching

  • Copies of repos housed within the repo structure

  • Allow for working on repo without changing main branch

  • Can help for more complex collaboration