Push changes to git remote repository

Overview

Once you are done working or making changes and committing them to the local repository. We can push the changes to the remote GitHub repository.

https://www.testingdocs.com/commit-changes-to-a-git-repository/

git push

To check the remote repository URL, we can issue the following command.

$ git remote -v

To push changes to the remote repository, issue the following command.

$ git push origin master

 

Git Push command

Command output

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits)
nothing to commit, working tree clean
[email protected] MINGW64 ~/SampleProject (master)
$ git remote -v
origin https://github.com/yskumar007/SampleProject.git (fetch)
origin https://github.com/yskumar007/SampleProject.git (push)
[email protected] MINGW64 ~/SampleProject (master)
$ git push origin master
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 4 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 916 bytes | 36.00 KiB/s, done.
Total 7 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/yskumar007/SampleProject.git

 

In real-time project several team members would be pushing changes to the remote repository. To pull the changes from the GitHub to the local repository, we can use the git pull command.

$git pull origin master