I worked on php Project and i want to upload into "github" I am new in Github, I want to know that what is difference between "git push origin master" and "git push origin main" ?
Thank you in advance.
I worked on php Project and i want to upload into "github" I am new in Github, I want to know that what is difference between "git push origin master" and "git push origin main" ?
Thank you in advance.
git push origin master
is pushing the code to the master branch.
git push origin main
is pushing the code to the main branch.
Origin and Master are two different terminologies used when working and managing the git projects.
Origin is the name used for the remote repository.
Master / Main is the name of the branch.
Both are the names of branches on a repository on Git.
The master branch is the main branch on the code repository and now it is famous as the Main branch in Git.
So when you add changes to your repository You can use git push origin master
or git push origin main
in your repository.
If suppose you have name dev as branch name then you need to use that name like :
git push origin dev
Like others have answered before: main
or master
is just name of a branch. It can have an arbitrary name and which one is to be considered the "main" branch is up to convention.
Earlier versions of git used master
so a lot of older repositories use this name. In recent times, main
is favored.
It's really up to the individual project which branch to use.
There are also political issues involved. From a practical point of view, main
is shorter by two letters so it saves some typing.