> README.md git init g...">

Does "origin" have any particular meaning?

I installed several github repositories using this documentation:

echo "# foo" >> README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/foo-1/foo.git git push -u origin master 

Does the name origin any special meaning?

If it is so purely semantic?

+5
source share
1 answer

Now this is just the default name for the upstream cloned repository.
But earlier it was a branch (before the start of git 1.5.0 in early 2007):

The very first commit introducing ' origin ' dates from 1cadb5a (July 2005, git 0.99.2) .
Next, commit a692b96 , which explains:

The recommended work cycle for an individual developer who does not have a “public” repository is slightly different. This happens as follows:

(1) Prepare your working repository, the “ git clone ” public repository of the “project” (or “subsystem assistant” if you are working in the subsystem). The URL used for initial cloning is stored in .git/branches/origin .

(2) Do your work there. Make a fix.

(3) Run " git fetch origin " from the shared repository of your upstream every once in a while. This does only the first half of the "git pull", but does not merge.
The head of the public repository is stored in .git/refs/heads/origin .

This workflow has obviously been very adapted to the distributed development of the Linux kernel, in which you had only one upstream repo.


.git/branches/origin will not become .git/remotes/origin until commit 6687f8f (August 2005, git v0.99.5) , when you can get more than one upstream repository .

Now the multitasking selection is completed, allowing you to transfer the default configuration for new repositories created using the " git clone " command.

The original $GIT_DIR/branches is not outdated yet, but by default create a remit directory from the templates.


Then commit e125c1a (November 2005, v0.99.9c) added:

In a recently cloned repository, .git/remotes/origin was configured by default to track the remote master to origin , but forgot to create an origin branch. He also rigidly defined the assumption that the remote HEAD points to " master ", which may not always be true.


It began to evolve to “origin” as an upstream repo in commit dfeff66 (March 2006, git 1.3.0) , where

The headers of the upstream headers are copied to the .git/refs/remotes/ instead of the .git/refs/heads/ and the .git/remotes/origin file is configured to reflect this.
This requires Eck Wong to update / delete the update in order to understand .git/refs/remotes , then to update the repository cloned this way.

This is described in detail in commit c72112e .


The default is “origin” when the sample was introduced in commit 5e27e27 (July 2006, git 1.4.2) .


The remote origin is stored in ./git/config in commit 255cae8 (November 2006, git 1.5.0)

For example, what was .git/remotes/origin earlier:

  URL: proto://host/path Pull: refs/heads/master:refs/heads/origin 

Now added to .git/config as:

  [remote "origin"] url = proto://host/path fetch = refs/heads/master:refs/heads/origin 

git pull by default origin with commit 955289b (December 2006, git 1.5.0) :

Without any specification in the .git/config file, git-pull will execute " git-pull origin "; which, in turn, by default pulls from the first “pull”, the definition for the remote control is “ origin ”.

After that, the glossary is updated:

origin

The default repository is up. Most projects have at least one upstream project that they track. By default, ' origin ' is used for this purpose .
New upstream updates will be uploaded to remote tracking branches named origin/name-of-upstream-branch , which you can see with " git branch -r ".

+6
source

All Articles