This quick and fun introduction will get you started using GitHub in less than an hour.
When you select Start course or Use this template, you will be prompted to create a new repository. We recommend creating a public repository, as private repositories will use Actions minutes.
Optional: For this course, set "owner" and "repository name" to your login name.
After you make your own repository, wait about 20 seconds and refresh. I will go to the next step.
People use GitHub to build some of the most advanced technologies in the world. Whether you’re visualizing data or building a new game, there’s a whole community and set of tools on GitHub that can help you do it even better. GitHub Learn’s “Introduction to GitHub” course guides you through everything you need to start contributing in less than an hour.
- Who is this for: New developers, new GitHub users, and students.
- What you'll learn: We'll introduce repositories, branches, commits, and pull requests.
- What you'll build: We'll make a short Markdown file you can use as your profile README.
- Prerequisites: None. This course is a great introduction for your first day on GitHub.
- How long: This course is four steps long and takes less than one hour to complete.
Welcome to "Introduction to GitHub"! 👋
What is GitHub?: GitHub is a collaboration platform that uses Git for versioning. GitHub is a popular place to share and contribute to open-source software.
📺 Video: What is GitHub?
What is a repository?: A repository is a project containing files and folders. A repository tracks versions of files and folders.
📺 Video: Exploring a repository
What is a branch?: A branch is a parallel version of your repository. You can make edits in your branch without impacting the main
version. Branches allow us to separate our work from the main
branch. In other words, everyone's work is safe while you contribute.
📺 Video: Branches
- Open a new browser tab, and work on the steps in your second tab while you read the instructions in this tab.
- Navigate to the Code tab.
- Click Branch: main in the drop-down.
- In the field, enter a name for your branch:
my-first-branch
. - Click Create branch: my-first-branch or press the Enter key to create your branch.
- Wait about 20 seconds then refresh this page for the next step.
You created a branch! 🎉
Creating a branch allows you to edit to your project without changing the main
branch. Now that you have a branch, it’s time to create a file and make your first commit!
What is a commit?: A commit is a set of changes to the files and folders in your project. A commit exists in a branch.
The following steps will guide you through the process of committing a change on GitHub.
- Create a new file on this branch called
PROFILE.md
.- Make sure you are on the "Code" tab.
- In the branch drop-down, select
my-first-branch
. - Click Create new file.
- In the "file name" field, type
PROFILE.md
.
- When you’re done naming the file, add the following content to your file:
Welcome to my GitHub profile!
- After adding the text, you can commit the change by entering a brief commit message
Add PROFILE.md
in the text-entry field below the file edit view. - After you’ve entered a commit message, click Commit new file.
- Wait about 20 seconds then refresh this page for the next step.
Nice work making that commit ✨
Now that you’ve created a commit, it’s time to share your proposed change through a pull request!
What is a pull request?: Collaboration happens on a pull request. The pull request shows the changes in your branch to other people. This pull request is going to keep the changes you just made on your branch and propose applying them to the main
branch.
📺 Video: Introduction to pull requests
- Open a pull request:
- From the "Pull requests" tab, click New pull request.
- In the "base:" drop-down menu, make sure the "main" branch is selected.
- In the "compare:" drop-down menu, select
my-first-branch
.
- When you’ve selected your branch, enter a title for your pull request:
Add my first file
. - The next field helps you provide a description of the changes you made. Feel free to add a description of what you’ve accomplished so far. As a reminder, you have: created a branch, created a file and made a commit, and opened a pull request.
- Click Create pull request.
- Wait about 20 seconds then refresh this page for the next step.
Nicely done friend! 😎
You successfully created a pull request. You can now merge your pull request.
What is a merge: A merge adds the changes in your pull request and branch into the main
branch.
📺 Video: Understanding the GitHub flow
- Click Merge pull request.
- Click Confirm merge.
- Once your branch has been merged, you don't need it anymore and you may click Delete branch.
- Wait about 20 seconds then refresh this page for the next step.
Congratulations friend, you've completed this course!
Here's a recap of all the tasks you've accomplished in your repository:
- You learned about GitHub, repositories, branches, commits, and pull requests.
- You created a branch, a commit, and a pull request.
- You merged a pull request.
- You made your first contribution! 🎉
- If you'd like the contents of your
PROFILE.md
file to be on your GitHub profile:- Make a new branch.
- Edit the contents into this
README.md
file. - Delete
PROFILE.md
on your branch. - Open and merge a pull request using your branch.
- We'd love to hear what you thought of this course in our community forum.
- Take another GitHub Learn course.
- Read the GitHub Getting Started docs.
- To find projects to contribute to, check out GitHub Explore.
Get help: Post in our community forum • Review the GitHub status page
© 2022 GitHub • Code of Conduct • CC-BY-4.0 License