A Brief Beginner’s Guide to GitHub
Why should you use GitHub?
Personal Use
Organization
- Repositories are like directories for your code or project
- Repositories can be public, if you want others to see your code or to collaborate, or private, if you want to use Git and GitHub functionality without sharing your code.
Version control
- GitHub offers Git server as a service to track changes you make to your code, so you can always go back and view a history of changes you’ve made
Collaboration
Share code
- People can see your code and copy it directly to their computer by downloading a
.zip
file or by ‘cloning’ your repository - People can also ‘fork’ your repository to have their own repository on GitHub that keeps up with changes to the your repo (see more about forking below)
Get input from others
- People can ‘fork’ your repository, make changes, and then open a ‘pull request’
- In this way, they are ‘suggesting a change’ to your code, website, etc.
Collaborate directly
- You can ‘add collaborators’ to a repository so multiple people can work on it at the same time and you can directly make changes
GitHub Vocab
Repositories (or ‘repos’) contain all of your project’s files and each file’s revision history
Clone a repository to create a local copy on your computer and sync between two locations
Fork a repository to make a copy and freely experiment with changes without affecting the original project
Branches can be used to isolate development work without affecting other branches in the repository
Push commits made on your local branch to a remote repository
Pull / Pull request lets you tell others about changes you’ve pushed to a repository
Commit records changes to one or more files in your branch
GitHub Video Tutorial
This video tutorial provides an intro to using Git and GitHub. Follow along with the corresponding tutorial here. This webinar is presented by Luke Thompson, an Associate Research Professor at the Northern Gulf Institute at Mississippi State University & Atlantic Oceanographic and Meteorological Laboratory (AOML). The webinar was hosted by the NOAA Central Library.