Open In App
Related Articles

Difference Between Git Push Origin and Git Push Origin Master

Improve Article
Save Article
Like Article

Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git relies on the basis of distributed development of software where more than one developer may have access to the source code of a specific application and can modify changes to it that may be seen by other developers.

Git Push Origin and Git Push Origin Master had a big difference before the git version 1.7.11. At that time 

git push origin 

by default pushes all your branches to the origin. While

git push origin master 

pushing your master branch to the origin. 

This behavior of git has been changed now, git push origin on Git >=2.0 by default pushes the current branch to a matching branch of the same name. But this behavior, as per convenience can be overridden via git config. Now, git push is used to push the content to a remote branch. 


If you are using “git push origin” then it may push all the branches, whatever you have configured or committed to push from your repo. This is its default behavior which could be changed.  If you are not aware of what is going to be pushed i.e., what all files are configured to be pushed, then in some respect it’s always on the safer side to prefer “git push origin master”. Now, there arose a question, why this question was asked in 2021 when the things have been modified earlier.  Git had clarified and corrected the use earlier after all git version>=2.0, but the documentation was never corrected. It was corrected on 24 March 2021, after someone corrected it on Github. See commit 4c8e3dc for more information on this.

Git Push Origin vs Git Push Origin Master

Git Push Origin

Git Push Origin Master

Git Push Origin pushes all the branches to the main branch.  Git Push Origin Master pushes your master branch to the origin.

Command for this:

git push origin

Command for this:

git push origin master

Behavior could be changed via git config. Behaviour is by default.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 20 Feb, 2022
Like Article
Save Article
Similar Reads
Complete Tutorials