GIT

Git Push

Git Push is used to upload local changes to a central/remote repository. Using this command will add the most recent commits to remote repository.

In the tutorial we will learn how to upload local changes to central or remote repository. If you want to learn more about git use my git tutorial.

Git Push

After changing your or updating your files in local repository you can push your changes to remote repository with help of this command. It is is very popular command in git technology.

Origin is a default remote repository. Using git remote -v command you can find this.

Master is a default branch in git. Using git branch command you can check the current branch.

# git push origin master

Example :

# git push origin master

Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 11.90 KiB | 0 bytes/s, done.
Total 5 (delta 0), reused 0 (delta 0)
To https://github.com/tecrahul/tecadmin.net
   cd5dd84..3d31ae3  master -> master

Above command will help to upload the all changes to the origin remote repository under the master branch.

If you run only #git push command without branch name it will use origin by default and it will push current active branch to the origin remote.

Git Push with Other Branch

Below command you can push changes of mybranch branch to remote develop branch if you are woking on different local branch named “my branch”. Make sure you are on mybranch branch using git branch command.

# git push origin my branch

If required to push your local branch to a remote branch with different name. You can do this with specific remote branch.

# git push origin develop:remote-branch-name

FAQs

Question 1 : How can I push my commit in Git?

Answer : git push command is used to upload local changes to a central/remote repository.

Question 2 : What is git push commit?

Answer : This command is used puts your changes into local repository other side git push sends your changes to the remote location.

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment