What is the difference between 'origin' and 'remote' in git commands? -


this question has answer here:

in git lingo, origin , remote same thing? or origin refer local directory?

in case of git push -u origin master: of following interpretation correct?

  1. "push upstream remote repo called 'origin' , branch 'master'"
  2. "push local originating repo called 'origin' upstream 'master' branch"

appreciate clarification!

the answers question clarified 2 issues me:

  1. origin refers remote repo, rather local cloned copy of remote repo. not clear when 1 reads originis alias of remote , created @ time of git clone
  2. origin refers remote repo in git push -u origin master because local copies of repo implied , "rarely referenced".

in git lingo origin default name remote repo cloned. might equally have been called source or remote1 or remote.

remember git peer-to-peer, distributed system, not 1 built-in notion of client/server, master/slave, parent/child relationships (though these might imposed upon user in particular scenario).

all remotes equal. origin (and literally) first among equals (for cloned repo). :)

and jan points out in comments, name associated each remote intended convenience. if find origin not work can change it.

as interpretations of push statement, first closest being correct push command written push local master branch master branch on remote identified (locally configured) name origin.

if there no master branch in remote 1 created.

full details of push command , flags, options etc of course in docs.

you (if ever) refer 'local' repo explicitly since operations performed in context of repo.


Comments