FreeKB - Git (Version Control) git push command
Git (Version Control) - git push command

This assumes you are already cloned a repository from the source Git repo (typically called "origin") to a directory on your PC, such as the foo.git or bar.git repos.


After cloning a repository, by default, you will have a branch called "master" on your PC.


It's always a good idea to first using the git pull command to ensure your local repoistory contains the latest commits.

git pull


And then used the git checkout command to use the branch that contains a file you want to edit (master in this example).

git checkout master


And then modified a file named foo.txt in the master branch of the repository, and committed the change you made to foo.txt, using the git commit command.

git commit foo.txt


The git push command can now be used to all of the commits in one of your branches to the origin Git repository.


In this example, all of the commits in your master branch will be pushed to the origin Git repository.

git push origin master


Or, if foo.txt was in some other branch, such as a branch named feat/logging, you would push your local feat/logging branch to the origin Git repository.

git push origin feat/logging


Something like this should be returned.

Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 431 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
To ssh://
   511bd98..4f92bf5  master -> master


The -q or --quiet option can be used to suppress all output.

git push --quiet origin master


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter b412a in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |