{"meta":{"title":"Hello World","intro":"Follow this Hello World exercise to learn GitHub's pull request workflow.","product":"Get started","breadcrumbs":[{"href":"/en/get-started","title":"Get started"},{"href":"/en/get-started/start-your-journey","title":"Start your journey"},{"href":"/en/get-started/start-your-journey/hello-world","title":"Hello World"}],"documentType":"article"},"body":"# Hello World\n\nFollow this Hello World exercise to learn GitHub's pull request workflow.\n\n## Introduction\n\nThis tutorial teaches you GitHub essentials like repositories, branches, commits, and pull requests. You'll create your own Hello World repository and learn GitHub's pull request workflow, a popular way to create and review code.\n\nIn this quickstart guide, you will:\n\n* Create and use a repository.\n* Start and manage a new branch.\n* Make changes to a file and push them to GitHub as commits.\n* Open and merge a pull request.\n\n### Prerequisites\n\n* You must have a GitHub account. For more information, see [Creating an account on GitHub](/en/get-started/start-your-journey/creating-an-account-on-github).\n\n* You don't need to know how to code, use the command line, or install Git (the version control software that GitHub is built on).\n\n## Step 1: Create a repository\n\nThe first thing we'll do is create a repository. You can think of a repository as a folder that contains related items, such as files, images, videos, or even other folders. A repository usually groups together items that belong to the same \"project\" or thing you're working on.\n\nOften, repositories include a README file, a file with information about your project. README files are written in Markdown, which is an easy-to-read, easy-to-write language for formatting plain text. We'll learn more about Markdown in the next tutorial, [Setting up your profile](/en/get-started/start-your-journey/setting-up-your-profile).\n\nGitHub lets you add a README file at the same time you create your new repository. GitHub also offers other common options such as a license file, but you do not have to select any of them now.\n\nYour `hello-world` repository can be a place where you store ideas, resources, or even share and discuss things with others.\n\n1. In the upper-right corner of any page, select <svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-plus\" aria-label=\"Create something new\" role=\"img\"><path d=\"M7.75 2a.75.75 0 0 1 .75.75V7h4.25a.75.75 0 0 1 0 1.5H8.5v4.25a.75.75 0 0 1-1.5 0V8.5H2.75a.75.75 0 0 1 0-1.5H7V2.75A.75.75 0 0 1 7.75 2Z\"></path></svg>, then click **New repository**.\n\n   ![Screenshot of a GitHub dropdown menu showing options to create new items. The menu item \"New repository\" is outlined in dark orange.](/assets/images/help/repository/repo-create-global-nav-update.png)\n2. In the \"Repository name\" box, type `hello-world`.\n3. In the \"Description\" box, type a short description. For example, type \"This repository is for practicing the GitHub Flow.\"\n4. Select whether your repository will be **Public** or **Private**.\n5. Select **Add a README file**.\n6. Click **Create repository**.\n\n## Step 2: Create a branch\n\nBranching lets you have different versions of a repository at one time.\n\nBy default, your repository has one branch named `main` that is considered to be the definitive branch. You can create additional branches off of `main` in your repository.\n\nBranching is helpful when you want to add new features to a project without changing the main source of code. The work done on different branches will not show up on the main branch until you merge it, which we will cover later in this guide. You can use branches to experiment and make edits before committing them to `main`.\n\nWhen you create a branch off the `main` branch, you're making a copy, or snapshot, of `main` as it was at that point in time. If someone else made changes to the `main` branch while you were working on your branch, you could pull in those updates.\n\nThis diagram shows:\n\n* The `main` branch\n* A new branch called `feature`\n* The journey that `feature` takes through stages for \"Commit changes,\" \"Submit pull request,\" and \"Discuss proposed changes\" before it's merged into `main`\n\n![Diagram of the two branches. The \"feature\" branch diverges from the \"main\" branch and is then merged back into main.](/assets/images/help/repository/branching.png)\n\n### Creating a branch\n\n1. Click the **Code** tab of your `hello-world` repository.\n\n2. Above the file list, click the dropdown menu that says **main**.\n\n   ![Screenshot of the repository page. A dropdown menu, labeled with a branch icon and \"main\", is highlighted with an orange outline.](/assets/images/help/branches/branch-selection-dropdown-global-nav-update.png)\n\n3. Type a branch name, `readme-edits`, into the text box.\n\n4. Click **Create branch: readme-edits from main**.\n\n   ![Screenshot of the branch dropdown for a repository. \"Create branch: readme-edits from 'main'\" is outlined in dark orange.](/assets/images/help/repository/new-branch.png)\n\nNow you have two branches, `main` and `readme-edits`. Right now, they look exactly the same. Next you'll add changes to the new `readme-edits` branch.\n\n## Step 3: Make and commit changes\n\nWhen you created a new branch in the previous step, GitHub brought you to the code page for your new `readme-edits` branch, which is a copy of `main`.\n\nYou can make and save changes to the files in your repository. On GitHub, saved changes are called commits. Each commit has an associated commit message, which is a description explaining why a particular change was made. Commit messages capture the history of your changes so that other contributors can understand what you’ve done and why.\n\n1. Under the `readme-edits` branch you created, click the `README.md` file.\n2. To edit the file, click <svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-pencil\" aria-label=\"Edit file\" role=\"img\"><path d=\"M11.013 1.427a1.75 1.75 0 0 1 2.474 0l1.086 1.086a1.75 1.75 0 0 1 0 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 0 1-.927-.928l.929-3.25c.081-.286.235-.547.445-.758l8.61-8.61Zm.176 4.823L9.75 4.81l-6.286 6.287a.253.253 0 0 0-.064.108l-.558 1.953 1.953-.558a.253.253 0 0 0 .108-.064Zm1.238-3.763a.25.25 0 0 0-.354 0L10.811 3.75l1.439 1.44 1.263-1.263a.25.25 0 0 0 0-.354Z\"></path></svg>.\n3. In the editor, write a bit about yourself.\n4. Click **Commit changes**.\n5. In the \"Commit changes\" box, write a commit message that describes your changes.\n6. Click **Commit changes**.\n\nThese changes will be made only to the README file on your `readme-edits` branch, so now this branch contains content that's different from `main`.\n\n## Step 4: Open a pull request\n\nNow that you have changes in a branch off of `main`, you can open a pull request.\n\nPull requests are the heart of collaboration on GitHub. When you open a pull request, you're proposing your changes and requesting that someone review and pull in your contribution and merge them into their branch. Pull requests show diffs, or differences, of the content from both branches. The changes, additions, and subtractions are shown in different colors.\n\nAs soon as you make a commit, you can open a pull request and start a discussion, even before the code is finished.\n\nIn this step, you'll open a pull request in your own repository and then merge it yourself. It's a great way to practice the GitHub flow before working on larger projects.\n\n1. Click the **Pull requests** tab of your `hello-world` repository.\n\n2. Click **New pull request**.\n\n3. In the **Example Comparisons** box, select the branch you made, `readme-edits`, to compare with `main` (the original).\n\n4. Look over your changes in the diffs on the Compare page, make sure they're what you want to submit.\n\n   ![Screenshot of a diff for the README.md file. 3 red lines list the text that's being removed, and 3 green lines list the text being added.](/assets/images/help/repository/diffs.png)\n\n5. Click **Create pull request**.\n\n6. Give your pull request a title and write a brief description of your changes. You can include emojis and drag and drop images and gifs.\n\n7. Click **Create pull request**.\n\n### Reviewing a pull request\n\nWhen you start collaborating with others, this is the time you'd ask for their review. This allows your collaborators to comment on, or propose changes to, your pull request before you merge the changes into the `main` branch.\n\nWe won't cover reviewing pull requests in this tutorial, but if you're interested in learning more, see [About pull request reviews](/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews). Alternatively, try the [GitHub Skills](https://skills.github.com/) \"Reviewing pull requests\" course.\n\n## Step 5: Merge your pull request\n\nIn this final step, you will merge your `readme-edits` branch into the `main` branch. After you merge your pull request, the changes on your `readme-edits` branch will be incorporated into `main`.\n\nSometimes, a pull request may introduce changes to code that conflict with the existing code on `main`. If there are any conflicts, GitHub will alert you about the conflicting code and prevent merging until the conflicts are resolved. You can make a commit that resolves the conflicts or use comments in the pull request to discuss the conflicts with your team members.\n\nIn this walk-through, you should not have any conflicts, so you are ready to merge your branch into the main branch.\n\n1. At the bottom of the pull request, click **Merge pull request** to merge the changes into `main`.\n2. Click **Confirm merge**. You will receive a message that the request was successfully merged and the request was closed.\n3. Click **Delete branch**. Now that your pull request is merged and your changes are on `main`, you can safely delete the `readme-edits` branch. If you want to make more changes to your project, you can always create a new branch and repeat this process.\n4. Click back to the **Code** tab of your `hello-world` repository to see your published changes on `main`.\n\n## Conclusion\n\nBy completing this tutorial, you've learned to create a project and make a pull request on GitHub.\n\nAs part of that, we've learned how to:\n\n* Create a repository.\n* Start and manage a new branch.\n* Change a file and commit those changes to GitHub.\n* Open and merge a pull request.\n\n## Next steps\n\n* Take a look at your GitHub profile and you'll see your work reflected on your contribution graph.\n* If you want to practice the skills you've learned in this tutorial again, try the [GitHub Skills](https://skills.github.com/) \"Introduction to GitHub\" course.\n* In the next tutorial, [Setting up your profile](/en/get-started/start-your-journey/setting-up-your-profile), you'll learn how to personalize your profile and you'll also learn some basic Markdown syntax for writing on GitHub.\n\n## Further reading\n\n* [GitHub flow](/en/get-started/using-github/github-flow)"}