Skip to content

Committing to GitHub

Now that you’ve made some changes to your code, it’s time to commit them to GitHub.

Committing your changes is an essential part of the coding process, as it allows you to save your work and keep track of the changes you’ve made.

In this guide, you will learn how to commit your code changes to GitHub using Github Desktop.

Open Github Desktop on your computer.

If you are not already authenticated, you will need to sign in using your GitHub account.

Github Desktop Sign In

Check you are in the correct project by examining the ‘Current repository’ dropdown in the top left corner.

Github Desktop Current Repository

Before committing your changes, it’s a good idea to review them.

  1. You can do this by clicking on the ‘Changes’ tab in Github Desktop (if it is not already selected).

  2. Directly beneath the ‘Changes’ tab, you will see a list of all the files that have been modified

Github Desktop Changes Tab

When you click on a file, you will see a side-by-side comparison of the changes you’ve made in the large panel on the right.

Lines highlighted in green represent new code that has been added.

Lines highlighted in red represent code that has been removed.

Github Desktop Changes

Once you are happy with the changes you’ve made, it’s time to commit them.

  1. In the ‘Summary’ field to the bottom left of the screen, write a brief description of the changes you’ve made.

    e.g. “Link HTML, CSS and JS files”, “Capture user input”, “Add event listeners”

  2. In the ‘Description’ field, you can provide more detailed information about the changes if you wish.

  3. Click the ‘Commit to main’ button to commit your changes.

Github Desktop Commit Changes

After a few moments, your changes will disappear and the large right-hand panel will be replaced with various options for the project.

Your changes have now been ‘committed’ to Git. You will need to push them to GitHub.

Click the ‘Push origin’ button in the top right panel of the screen.

Github Desktop Push Changes

Once you have pushed your changes to GitHub, you can verify that they have been successfully uploaded by visiting your repository on GitHub.

The quickest way to do this is to click the ‘View on GitHub’ button in the right panel of the screen.

Github Desktop View Changes Online

You should see your changes reflected in the repository on GitHub.

In this guide we have:

  • Reviewed the changes you’ve made to your code
  • Committed your changes to GitHub
  • Pushed your changes to GitHub
  • Verified your changes on GitHub
  1. Continue working on your project.

In the next step, we will look at how to debug problems in your code using VS Code.