Github Introduction

Create a branch

Your first branch

  1. Open a new browser tab, and navigate to this same repository. Then, work on the steps in your second tab while you read the instructions in this tab.

  2. Navigate to the Code tab.

  3. Click on the main branch drop-down. image showing my-first-branch entry

  4. In the field, enter a name for your branch: my-first-branch.

  5. Click Create branch: my-first-branch to create your branch.

  6. Move on to Step 2!

Commit a file

The following steps will guide you through the process of committing a change on GitHub. Committing a change requires first adding a new file to your new branch.

  1. On the Code tab, make sure you're on your new branch my-first-branch.

  2. Select the Add file drop-down and click Create new file. create new file option

  3. In the Name your file... field, enter PROFILE.md.

  4. In the Edit new file area, copy the following content to your file:

    Welcome to my GitHub profile!

    profile.md file screenshot

  5. For commits, you can enter a short commit message that describes what you changes you made. This helps others know what's included in your commit. GitHub offers a simple default message, but let's change it slightly for practice. Enter Adding PROFILE.md in the first text-entry field below Commit new file. Then, if you want to confirm what your screen should look like, expand the dropdown below.

  6. In this lesson, we'll ignore the other fields and click Commit new file.

Open a pull request

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.

screenshot of message and button

If you want, feel free to 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.

  1. Click on the Pull requests tab in your repository.

  2. Click New pull request.

  3. In the base: dropdown, make sure main is selected.

  4. Select the compare: dropdown, and click my-first-branch. screenshot showing both branch selections

  5. Click Create pull request.

  6. Enter a title for your pull request: Add my first file.

  7. 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! screenshot showing pull request

  8. Click Create pull request.

  9. Move on to Step 4!

Merge your pull request

  1. Click Merge pull request.

  2. Click Confirm merge.

  3. Once your branch has been merged, you don't need it anymore. To delete this branch, click Delete branch. screenshot showing delete branch button

Last updated