Git & GitHub Tutorial
Learn Git and GitHub step by step: repositories, commits, branches, pull requests, collaboration, GitHub Pages and Actions.
- Topics
- 19
- Full lessons
- 19
- Est. hours
- ~3
- Interview Qs
- 0
Overview
Git saves every version of your project; GitHub keeps it online so you can back it up, share it and work with others. Every software job expects you to know both.
This track starts from zero and shows each step with pictures of GitHub and VS Code: create an account and a repository, commit and push, work on branches, open pull requests, fix conflicts, collaborate, publish a website with GitHub Pages and run your first GitHub Actions workflow.
What you will learn
- Create repositories and write good commits
- Work on branches and merge them with pull requests
- Collaborate through forks, issues and protected branches
- Publish a website with GitHub Pages and automate checks with Actions
Prerequisites
None — this track starts from the very beginning.
Learning path
The recommended sequence, from beginner to advanced. Each stage builds on the one before.
- 1Getting Started · 3 topics · BeginnerIntroduction to Git and GitHub · Installing Git · Creating a GitHub Account
- 2Your First Repository · 3 topics · BeginnerCreating a Repository · Editing and Uploading Files · Writing a README
- 3Daily Workflow · 6 topics · Beginner → IntermediateCloning a Repository · Commit, Push and Pull · Branches · Pull Requests · Merge Conflicts · .gitignore
- 4Collaboration · 4 topics · Intermediate → AdvancedForks and Open Source · Issues · Collaborators and Branch Protection · SSH Keys and Tokens
- 5Publish & Automate · 3 topics · AdvancedGitHub Pages · GitHub Actions Basics · Your GitHub Profile
Complete topic list
19 topicsGetting Started
3 topics- Introduction to Git and GitHubBeginner5m
- Installing GitBeginner5m
- Creating a GitHub AccountBeginner5m
Your First Repository
3 topics- Creating a RepositoryBeginner5m
- Editing and Uploading FilesBeginner5m
- Writing a READMEBeginner5m
Daily Workflow
6 topics- Cloning a RepositoryBeginner5m
- Commit, Push and PullBeginner5m
- BranchesBeginner5m
- Pull RequestsIntermediate5m
- Merge ConflictsIntermediate5m
- .gitignoreIntermediate5m
Collaboration
4 topics- Forks and Open SourceIntermediate5m
- IssuesIntermediate5m
- Collaborators and Branch ProtectionIntermediate5m
- SSH Keys and TokensAdvanced5m
Publish & Automate
3 topics- GitHub PagesAdvanced5m
- GitHub Actions BasicsAdvanced5m
- Your GitHub ProfileAdvanced5m
Code example
A taste of the track, from Introduction to Git and GitHub.
git clone https://github.com/asha/hello-github.git # copy a repository to your computer
cd hello-github
# ...edit index.html in VS Code...
git add index.html # 1. stage the change
git commit -m "Add a welcome line" # 2. save a snapshot
git push # 3. upload it to GitHub
git pull # 4. download changes made by others
[main 3f9c2a1] Add a welcome line 1 file changed, 1 insertion(+) To https://github.com/asha/hello-github.git 8d41e07..3f9c2a1 main -> main Already up to date.
Practice exercises
Write the command that shows the history of commits in the current repository, one line per commit.
Show only the email address Git will use for your commits.
Write the URL of the GitHub profile for the username asha.
Write the HTTPS clone URL for the repository hello-github owned by asha.
Write a good commit message for adding a footer with your email address.
Write the Markdown for a link with the text “Live demo” to https://asha.github.io.
Show all 19 exercises
Show where your repository pushes to.
Stage only README.md and commit it with the message “Update README”.
Create and switch to a branch called fix/footer-link.
After a PR was merged on GitHub, update your local main branch.
Cancel a merge that went wrong and return to the state before it.
Stop tracking the already-committed file .env without deleting it from your disk.
Add the original repository https://github.com/original/app.git as a remote named upstream.
Write the PR description line that closes issue 27 when merged.
Name the two options you would always tick for main in a team.
Test whether your SSH key works with GitHub.
Write the address of the project site for the repository hello-github owned by asha.
Write the on: line that runs a workflow for pushes and pull requests.
Write the name of the repository that holds the profile README for the user asha.