Push Changes
Learn to push changes from the local repository to the remote repository.
We'll cover the following
Once we add the remote repository URL to our local repository using the git remote
command, we’ll push or upload our local code and its revision history to the remote repository. This can be done using git push
.
How do we push a local branch?
When we have a remote, we can git push
a branch to the remote repository.
$ git push <Remote name> <Branch name>
For example, usually, we push to the default remote (origin
) and default branch (master
).
$ git push origin master
The git push
command updates the remote repository code with all the updates made in the local repository.
Below is a visualization of what happens when we push the code to a remote repository:
Get hands-on with 1400+ tech skills courses.