Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm new to git as a version control system. I tried reading the documentation, but I don't understand what "master" means in the command "git push origin master".

Can someone explain in very dumbed-down terms?

Thanks

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

This is the Master branch. The main tree of your control system.

push = push your changes to the remote server
origin = remote Server origin
master = Master branch

If you have another remote branches you have something like "git push origin test" then you push your changes to the test remote branch.

share|improve this answer
    
git push origin test pushes the local test branch to origin/test. Just in case somebody was expecting the current branch to get pushed. –  JonnyJD Dec 22 '12 at 17:41
add comment

That master is the <src> part of a refspec.

This means that your local master branch will be pushed to the master branch of the remote origin (orgin/master).


If you would have specified

git push origin master:my_work

then you would have pushed your local master to origin/my_work. If you don't use the :my_work part, then the destination defaults to the same branch as given as source.


Just specifying

git push origin

will push every local branch that has a matching remote branch to that branch per default. Not just the current branch. This is the same as using git push origin :.

You can change this default with git config remote.origin.push HEAD, which would push the current branch to a remote branch with the same name.

See configure-a-local-branch-for-push-to-specific-branch for further details on configuring refspecs and setting push.default.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.