Want to create interactive content? It’s easy in Genially!

Reuse this genially

GitHub 101

Harsha Gaddipati

Created on March 8, 2025

Start designing with a free template

Discover more than 1500 professional designs like these:

Customer Service Course

Dynamic Visual Course

Dynamic Learning Course

Akihabara Course

Transcript

GitHub 101

A Beginner's Guide to Version Control and Collaboration

Start

Objectives

Through this instructional guide you will learn how to:

  • Set up and manage your own GitHub repositories.
  • Use basic Git commands like clone, commit, and push.
  • Work together using branches and pull requests.
  • Fix common problems, like merge conflicts.

Modules

Index

Activities

Click on a section to jump ahead!

Assessment

Survey

Getting Started with Git and GitHub

Explain the basics of Git and GitHub, including the difference between local and remote repositories

Modules

Mastering Basic Git Commands

Teaches you how to use essential Git commands

Collaborative Coding

Explains Git commands essential for collaboration such as merges & branches

Getting Started with Git and GitHub

What are Git and GitHub?

* Git: A version control system allowing you to track code changes locally * GitHub: A platform to host, share, and collobarotate on Git repositories * Think of Git as a log of all changes to a repository; and GitHub is the shelf where everyone places their seperate logs.

+Info

Getting Started with Git and GitHub

Creating a GitHub Account

1) Visit https://github.com/ and click sign up 2) Enter your email, username, and password 3) Verify your email and pick the free version (for this we won't need to pay!)

Getting Started with Git and GitHub

First Steps with Git

1) Install Git

Visit the attached link to see instructions on how to install Git depending on your operating system

2) Configure Git

* git config --global user.name * git config --global user.email

3) Create your first GitHub Repo!

Complete the activity to learn how to make your first repository

Mastering Basic Git Commands

Git Workflow Overview

With Git you have the following stages:Working Directory -> Staging Area -> Local Repo -> Remote Repo- Edit: When you edit files you change them in your working directory - Stage: You use git add to put changes in staging area - Commit: You save changes to local repo - Push/Pull: Push and pull sync local repo w/ remote

Watch this video to get a basic understanding of how Git works. This will be helpful in fully understanding the purpose of all the commands.

Mastering Basic Git Commands

Try it Out!

Basic Git Commands

git push

git clone <url>

Uploads local commits to remote repo
Copies GitHub repository to local machine

git pull

git add <file>

Downloads all changes from remote into local
Stages changes for next commit

git status

git commit -m "message"

Shows state of working directory and staging area
Saves changes to local repo with message

Collaborative Coding

Introduction to Collaboration

The real power of GitHub lies in its ability to make working with others seamless. In this module we'll go over a few basic commands to get you started on being able to work with others!

Typically when collaborating in a team. Each individual will work on their own branch. This helps avoid conflicts between individuals as their codebases will be different. Only once a feature is made or bug is fixed are the branches then "merged" into the main branch. This allows for there to be little conflicts in code and only one point where you need to determine how to integrate changes back into the main codebase.

Collaborative Coding

Branching Basics

git branch <name>

What is a branch?

Creates a new branch with the specified name

A branch is like a separate workspace in your repo where you can work on new features, fixes, or experiments without affecting the main codebase.

git checkout <name>

git branch

Switches local repo to specific branch. The default branch is usually called main.

Shows all branches currently in local repo and marks current branch with a *

Try it Out!

Collaborative Coding

Pull Request (PR) Overview

What is a pull request?Pull requests are a way to propose changes to a repo, get feedback and merge those changes into the main branch- Push: First push your local changes to a remote branch - Create PR: Use GitHub to create a PR - Review: Have team members review your PR to ensure the code is up to standard - Merge: If your PR passes the review then merge the changes!

Watch this video to get a basic understanding of how pull requests works. You should never attempt to merge a branch into the remote repo without having someone else review your pull request.

Create your first GitHub Repo

Learn how to make a repo and bring it into your local environment

Activities

Practice basic GitHub Commands

These activities will help reinforce what you learn in our modules :)

After creating your repo, practice basic GitHub commands

Practice branching

Create a branch and merge it with your own PR!

Getting Started with Git and GitHub

Create the Repo

Go to github.com, and on the home page there should be an option to create a new repository. Type in the name "demo", set the visibility to public and click create a new repository.

For the tutorial, set your repository to public. However, if you want to keep it hidden from the world, you can set it to private.

Getting Started with Git and GitHub

Copy the URL

Once you create the repository make sure to copy the HTTPs url of the repository. This will be important in the next step.

If you forget to do this after creating the repository you can still copy the url from the repository page itself

Getting Started with Git and GitHub

Clone the Repo

Use git clone [repo url] in your terminal to copy over the reposito ry into your local environment

Note: You can clone a repository as well that has files.

After cloning the repository you should have an empty folder labelled demo on your computer. Congratulations, you've made your first GitHub repository!!!

In our next steps we'll make this repo a little less empty :)

Mastering Basic Git Commands

Making Changes

Use git pull before you start to ensure all remote changes are brought in. Ignore the error message as that is just because nothing is in the repo

Next lets add a file to our repo, by creating a README.md file and put in some sample text.

Now lets check with git status to see what files are changed. You should see the README.md file under untracked. This is because to this point the file has not been staged at any point.

Mastering Basic Git Commands

Pushing Changes

Lets use git add . to stage all our changes

Now lets commit the change to our local repo

Finally lets push our local repo changes to the remote repo!!! If you check on github.com your repo you should be able to see the new README.md file :)

Collaborative Coding

Making a Branch

Lets use git branch to make a new branch. Then lets use git checkout to switch to that branch.

Now lets update our README.md file

Finally lets push our local repo changes to the remote repo!!! If you check on github.com your repo you should be able to see the new first_pr branch :)

Collaborative Coding

Making a PR

Go to www.github.com and visit your repo. You should see a button asking you to compare and pull request your first_pr branch. Click on that button.

Note that it says able to merge for this PR. That means that none of the changes in this branch conflict with changes in the main branch.

Add in a description of your pr and click create pull request to make your PR!

Collaborative Coding

Reviewing a PR

At the top of your PR you can see the title

By looking at the tabs you can see the commits in this PR and what exactly has changed

GitHub does an automatic check to see if you can merge the branch without any conflicts. If it is possible you can just click the button to combine your branches. For this activity click this button to merge your branch into main.

A review as well can add comments to a pull request to give feedback on it. This is very important, especially if there are any problems in the code.

With that you've merged your first PR!!

Evaluation

1/5

Evaluation

2/5

Evaluation

3/5

Evaluation

4/5

Evaluation

5/5

Survey

1/5

Survey

2/5

Survey

3/5

Survey

4/5

Survey

5/5

Why do we need to do this?

Setting your git name and email allows for all changes you make to a repository to be attached to your name

git commit

  • git commit saves staged changes to local repo with message
  • Syntax: git commit -m "message"
  • Example: git commit -m "Add new feature"
  • Tip: Use clear concise messages with commits so others can easily understand what each commit means (i.e. "Fixed off-by-one-error")

git clone

  • git clone copies a remote GitHub repo to your computer
  • Syntax: git clone <repository-url>
  • Example: git clone https://github.com/username/repo.git
  • Tip: Get the URL from the 'Code' button on GitHub!

git status

  • git status shows the state of files in your local repo. It tells you which files have been changed and which are staged.
  • Syntax: git status
  • Example: git status
  • Tip: Use before committing to see what files are staged compared to what has been changed.

Getting Started with Git and GitHub

More about Git vs GitHub

git pull

  • git pull downloads and merges changes from the remote repo to your local repo
  • Syntax: git pull <remote> <branch>
  • Example: git pull origin main
  • Tip: Usually you can just do git pull w/o specifying remote or branch
  • Tip: Pull everytime before you edit to avoid conflicts!

git add

  • git add stages changed files so they can be saved
  • Syntax: git add <file>
  • Example: git add README.md
  • Tip: git add . can be used to add all changed files to be staged

git push

  • git push uploads commits from the local repo to the remote repo
  • Syntax: git push <remote> <branch>
  • Example: git push origin main
  • Tip: For now you can do git push origin main until you learn about remotes and branches
  • Tip: Before pushing make sure you have a commit!