Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Podia.

Push changes to a remote repository – GitHub

Summary

To push changes to a remote repository, enter the following command in your terminal:

git push remote-name branch-name

Replace remote-name with the name of the remote repository and branch-name with the name of the remote branch.

Details

The core command in the above example is git push. remote-name and branch-name are arguments for the command.

To push your changes to your local main/master branch up to the main/master branch in the remote repository, enter the following command in your terminal (this example assumes you named your remote repository origin):

git push origin main

If you had a topic branch named add-about-page, you could push your local changes from it to the remote repository by entering the following command in your terminal:

git push origin add-about-page

If the branch doesn’t already exist on the remote repo, it’ll be added automatically.

Exercises

Use the command from the Details section to push your changes to GitHub (if your original branch is called main on GitHub, you should use main instead of master).

References

Pushing commits to a remote repository from GitHub Help

Back to: GitHub Reference