Get started using GitHub in less than an hour.
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 Skills’ “Introduction to GitHub” course guides you through everything you need to start contributing in less than an hour.
Course tips:
- Glossary terms will be emphasised and linked to their definition.
- Right-click Start course and open the link in a new tab.
- In the new tab, enter the following information
- Choose your personal account to host the repository.
- Name the repository: introduction-to-github-. Change to your first name.
- Use a public repository.
- Scroll down and click the Create repository button at the bottom of the form.
- After your new repository is created, wait about 20 seconds, then refresh the page. Follow the step-by-step instructions in the new repository's README.
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?
-
Navigate to the Projects tab in the header menu of your repository. (If you don't have this tab, click the settings tab and enable "projects" in the list of features)
-
Click Link a project and in the dropdown Create a new project...
-
In the popup window, choose Board as template type in the left menu
-
Name your board as you wish and click Create
-
Now we will add our first issue to our board. This is done by navigating to the Todo column and clicking +Add Item
-
In the bar, start typing # to get the available repositories. Choose your repository named "introduction-to-github-(name)"
-
Now you have the option to add issues. Click Create new issue
-
Name the issue "Learning GitHub" and click create.
Great, now we have our first project board with an issue! Let's now focus on finishing it. 🚀
What is a repository?: A repository is a project containing files and folders. A repository tracks versions of files and folders. For more information, see "About repositories" from GitHub Docs.
What is a branch?: A branch is a parallel version of your repository. By default, your repository has one branch named main
and it is considered to be the definitive branch. Creating additional branches allows you to copy the main
branch of your repository and safely make any changes without disrupting the main project. Many people use branches to work on specific features without affecting any other parts of the project.
Branches allow you to separate your work from the main
branch. In other words, everyone's work is safe while you contribute. For more information, see "About branches".
-
Open a new browser tab and navigate to your newly made repository. Then, work on the steps in your second tab while you read the instructions in this tab.
-
Navigate to the < > Code tab in the header menu of your repository.
-
Click on the main branch drop-down.
-
In the field, enter a name for your branch:
my-first-branch
. -
Click Create branch: my-first-branch to create your branch.
The branch will automatically switch to the one you have just created. The main branch drop-down bar will reflect your new branch and display the new branch name.
-
Move on to Step 3!
Note: If you made a public repository, and want to confirm you correctly set up your first branch, wait about 20 seconds then refresh this page (the one you're following instructions from). GitHub Actions will automatically close this step and open the next one.
You created a branch! 🎉
Creating a branch allows you to edit 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. For more information, see "About commits".
The following steps will guide you through the process of committing a change on GitHub. A commit records changes in renaming, changing content within, creating a new file, and any other changes made to your project. For this exercise, committing a change requires first adding a new file to your new branch.
-
On the < > Code tab in the header menu of your repository, make sure you're on your new branch
my-first-branch
. -
Select the Add file drop-down and click Create new file.
-
In the Name your file... field, enter
PROFILE.md
.Note:
.md
is a file extension that creates a Markdown file. You can learn more about Markdown by visiting "Basic writing and formatting syntax" in our docs or by taking the "Communicating using Markdown" Skills course. -
In the Edit new file area, copy the following content to your file:
Welcome to my GitHub profile!
-
For commits, you can enter a short commit message that describes what changes you made. This message helps others know what's included in your commit. GitHub offers a simple default message, but let's change it slightly for practice and also include our issue. In the commit message we want to refer to our issue in the project board. In your commit message, enter
Close #1
in the first text-entry field below Commit changes at the bottom of the page. By writing the key word Close we are implying that we have finished our issue and that it should be closed when the code is merged in the master branch. -
In this lesson, we'll ignore the other fields and click Commit changes....
-
Move on to Step 4!
Note: Like before, you can wait about 20 seconds, then refresh this page (the one you're following instructions from) and GitHub Actions will automatically close this step and open the next one.
Nice work making that commit! ✨
Now that you have made a change to the project and 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 and allows people to accept, reject, or suggest additional changes to your branch. In a side by side comparison, this pull request is going to keep the changes you just made on your branch and propose applying them to the main
project branch. For more information about pull requests, see "About pull requests".
You may have noticed after your commit that a message displayed indicating your recent push to your branch and providing a button that says Compare & pull request.
To create a pull request automatically, click Compare & pull request, and then skip to step 6 below. If you don't click the button, the instructions below walk you through manually setting up the pull request.
-
Click on the Pull requests tab in the header menu of your repository.
-
Click New pull request.
-
In the base: dropdown, make sure main is selected.
-
Select the compare: dropdown, and click
my-first-branch
. -
Click Create pull request.
-
Enter a title for your pull request. By default, the title will automatically the name of your commit.
-
The next field helps you provide a description of the changes you made. Here, you can add a description of what you’ve accomplished so far. As a reminder, you have: created a new branch, created a file, and made a commit.
-
Click Create pull request. You will automatically be navigated to your new pull request.
-
Move on to Step 5!
Note: Like before, you can wait about 20 seconds, then refresh this page (the one you're following instructions from) and GitHub Actions will automatically close this step and open the next one. As a perk, you may see evidence of GitHub Actions running on the tab with the pull request opened! The image below shows a line you might see on your pull request after the Action finishes running.
Nicely done! 😎
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. For more information about merges, see "Merging a pull request" or watch the video linked below.
As noted in the previous step, you may have seen evidence of GitHub Actions running which automatically progresses your instructions to the next step. You'll have to wait for it to finish before you can merge your pull request. It will be ready when the merge pull request button is green.
-
Click Merge pull request.
-
Click Confirm merge.
-
After merging, you can now take a look at your project board again. (Check out step 1 if you don't remember how to navigate there) Your issue should now have moved from "Todo" column to "Done". Nice work! 🦾
-
Once your branch has been merged, you don't need it anymore. To delete this branch, click Delete branch.
-
Check out the Finish step to see what you can learn next!
Note: Like before, you can wait about 20 seconds, then refresh this page (the one you're following instructions from) and GitHub Actions will automatically close this step and open the next one.
Congratulations, you've completed this course and joined the world of developers!
Here's a recap of your accomplishments:
- 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 to make a profile README, use the quickstart instructions below or follow the instructions in the Managing your profile README article.
- Make a new public repository with a name that matches your GitHub username.
- Create a file named
README.md
in its root. The "root" means not inside any folder in your repository. - Edit the contents of the
README.md
file. - If you created a new branch for your file, open and merge a pull request on your branch.
- Lastly, we'd love to hear what you thought of this course in our discussion board.
Check out these resources to learn more or get involved:
- Are you a student? Check out the Student Developer Pack.
- Take another GitHub Skills course.
- Read the GitHub Getting Started docs.
- To find projects to contribute to, check out GitHub Explore.
Get help: Post in our discussion board • Review the GitHub status page
© 2022 GitHub • Code of Conduct • MIT License