Introduction to GitHub

Get started using GitHub in less than an hour.

Step 2: Commit a file

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".

⌨️ Activity: Your first commit

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.

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.

  1. On the < > Code tab in the header menu of your repository, 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 Enter file contents here area, copy the following content to your file:

    Welcome to my GitHub profile!
    

    profile.md file screenshot

  5. Click Commit changes... in the upper right corner above the contents box. 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. First, enter Add PROFILE.md in the first text-entry field titled "Commit message".

    screenshot of adding a new file with a commit message

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

  7. Wait about 20 seconds then refresh this page (the one you're following instructions from). GitHub Actions will automatically update to the next step.


Get help: Post in our discussion boardReview the GitHub status page

© 2024 GitHub • Code of ConductMIT License