Git Concepts: Difference between revisions
(→Remote) |
|||
Line 16: | Line 16: | ||
==Remote== | ==Remote== | ||
A ''remote'' is named entity whose definition is maintained in [[.git/config]] that represents a reference to a [[#Remote_Repository|remote repository]]. The remote can be seen as a short name for a long URL and other configuration information. | |||
[remote "origin"] | |||
url = git@github.com:NovaOrdis/events-api.git | |||
fetch = +refs/heads/*:refs/remotes/origin/* | |||
The 'url' is the URL of the remote repository. 'fetch' is a [[#Refspec|refspec]] | |||
where: | |||
__"url"__ is obviously the URL of the remote repository. For more on Git URLs see [Names in Git#GitURLs]. | |||
__"fetch"__ is a ''refspec'' that specifies how a local ref (which usually represents a branch) is mapped from the namespace of the source repository into the namespace of our repository. The content of these branches will be transferred when [git fetch#Internals] is executed. For more on refspecs, see [NamesInGit#Refspecs]. Instead of specifying * that signifies all branches, you can list individual branches there: | |||
{{{ | |||
... | |||
fetch = +refs/heads/dev:refs/remotes/origin/dev | |||
fetch = +refs/heads/stable:refs/remotes/origin/stable | |||
... | |||
}}} | |||
These definitions can be manipulated with [git config#RemoteManipulation]. | |||
The remote is used in assembling the full name for the [tracking branches|GitConcepts#TrackingBranch], also declared in .git/config. | |||
Remotes can be created, removed and manipulated with [git remote]. | |||
!Origin | |||
The "origin" is a special remote that refers to the repository the current repository was cloned from. The name "origin" is just a default value and it can be changed if so desired with --origin option of the [git clone] operation. | |||
==="origin"=== | ==="origin"=== |
Revision as of 20:37, 11 December 2017
Internal
Reference
References available in a remote repository can be listed with git ls-remote.
Local Repository
The repository maintained on a local filesystem that is currently interacted with is called the local or current repository.
Remote Repository
A repository maintained on a remote host, but with which files are exchanged, is called a remote repository. The references available in a remote repository can be listed with git ls-remote.
Remote
A remote is named entity whose definition is maintained in .git/config that represents a reference to a remote repository. The remote can be seen as a short name for a long URL and other configuration information.
[remote "origin"] url = git@github.com:NovaOrdis/events-api.git fetch = +refs/heads/*:refs/remotes/origin/*
The 'url' is the URL of the remote repository. 'fetch' is a refspec
where:
__"url"__ is obviously the URL of the remote repository. For more on Git URLs see [Names in Git#GitURLs].
__"fetch"__ is a refspec that specifies how a local ref (which usually represents a branch) is mapped from the namespace of the source repository into the namespace of our repository. The content of these branches will be transferred when [git fetch#Internals] is executed. For more on refspecs, see [NamesInGit#Refspecs]. Instead of specifying * that signifies all branches, you can list individual branches there:
{{{
... fetch = +refs/heads/dev:refs/remotes/origin/dev fetch = +refs/heads/stable:refs/remotes/origin/stable ...
}}}
These definitions can be manipulated with [git config#RemoteManipulation].
The remote is used in assembling the full name for the [tracking branches|GitConcepts#TrackingBranch], also declared in .git/config.
Remotes can be created, removed and manipulated with [git remote].
!Origin
The "origin" is a special remote that refers to the repository the current repository was cloned from. The name "origin" is just a default value and it can be changed if so desired with --origin option of the [git clone] operation.